diff options
author | FabianWolff <fabi.wolff@arcor.de> | 2020-09-03 03:48:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-02 18:48:36 -0700 |
commit | edd69cb2570692f36bf26b658e967c317ebc048e (patch) | |
tree | 0ec9063e7008788ce684b93c02252490cb90688f /src | |
parent | 8b4444dad1647c89b313deedd22129252078fe1b (diff) |
Drop {INCLUDE,LIBRARY,RUNTIME}_INSTALL_DIR variables in CMakeLists.txt (#4979)
On Debian (for instance), libraries aren't installed into `/usr/lib/`, but into something like `/usr/lib/x86_64-linux-gnu/`. In particular, this means that setting the `LIBRARY_INSTALL_DIR` to `lib` in the top-level `CMakeLists.txt` file is wrong.
Luckily, there is a simple solution: CMake provides [`CMAKE_INSTALL_LIBDIR`](https://cmake.org/cmake/help/v3.0/module/GNUInstallDirs.html) for this very purpose, which has sensible defaults and can be set by the user. In particular, since `CMAKE_INSTALL_LIBDIR` is a standardized variable, tools like the ones used for building Debian packages can set it to what they want it to be, whereas using a custom variable like `LIBRARY_INSTALL_DIR` wouldn't work in this setting.
Signed-off-by: Fabian Wolff <fabi.wolff@arcor.de>
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 28 | ||||
-rw-r--r-- | src/main/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/parser/CMakeLists.txt | 2 |
3 files changed, 17 insertions, 17 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 971648839..9523f9600 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -893,8 +893,8 @@ target_include_directories(cvc4 install(TARGETS cvc4 EXPORT cvc4-targets - LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR} - ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR}) + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) set_target_properties(cvc4 PROPERTIES SOVERSION ${CVC4_SOVERSION}) target_compile_definitions(cvc4 @@ -984,27 +984,27 @@ install(FILES api/cvc4cpp.h api/cvc4cppkind.h DESTINATION - ${INCLUDE_INSTALL_DIR}/cvc4/api) + ${CMAKE_INSTALL_INCLUDEDIR}/cvc4/api) install(FILES base/configuration.h base/exception.h base/listener.h base/modal_exception.h DESTINATION - ${INCLUDE_INSTALL_DIR}/cvc4/base) + ${CMAKE_INSTALL_INCLUDEDIR}/cvc4/base) install(FILES context/cdhashmap_forward.h context/cdhashset_forward.h context/cdinsert_hashmap_forward.h context/cdlist_forward.h DESTINATION - ${INCLUDE_INSTALL_DIR}/cvc4/context) + ${CMAKE_INSTALL_INCLUDEDIR}/cvc4/context) install(FILES include/cvc4.h include/cvc4_public.h include/cvc4parser_public.h DESTINATION - ${INCLUDE_INSTALL_DIR}/cvc4) + ${CMAKE_INSTALL_INCLUDEDIR}/cvc4) install(FILES expr/array.h expr/array_store_all.h @@ -1021,7 +1021,7 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/expr/kind.h ${CMAKE_CURRENT_BINARY_DIR}/expr/expr_manager.h DESTINATION - ${INCLUDE_INSTALL_DIR}/cvc4/expr) + ${CMAKE_INSTALL_INCLUDEDIR}/cvc4/expr) install(FILES options/language.h options/option_exception.h @@ -1029,7 +1029,7 @@ install(FILES options/printer_modes.h options/set_language.h DESTINATION - ${INCLUDE_INSTALL_DIR}/cvc4/options) + ${CMAKE_INSTALL_INCLUDEDIR}/cvc4/options) install(FILES parser/input.h parser/parser.h @@ -1037,25 +1037,25 @@ install(FILES parser/parser_exception.h parser/parse_op.h DESTINATION - ${INCLUDE_INSTALL_DIR}/cvc4/parser) + ${CMAKE_INSTALL_INCLUDEDIR}/cvc4/parser) install(FILES DESTINATION - ${INCLUDE_INSTALL_DIR}/cvc4/printer) + ${CMAKE_INSTALL_INCLUDEDIR}/cvc4/printer) install(FILES proof/unsat_core.h DESTINATION - ${INCLUDE_INSTALL_DIR}/cvc4/proof) + ${CMAKE_INSTALL_INCLUDEDIR}/cvc4/proof) install(FILES smt/command.h smt/logic_exception.h smt/smt_engine.h DESTINATION - ${INCLUDE_INSTALL_DIR}/cvc4/smt) + ${CMAKE_INSTALL_INCLUDEDIR}/cvc4/smt) install(FILES theory/logic_info.h theory/theory_id.h DESTINATION - ${INCLUDE_INSTALL_DIR}/cvc4/theory) + ${CMAKE_INSTALL_INCLUDEDIR}/cvc4/theory) install(FILES util/abstract_value.h util/bitvector.h @@ -1085,7 +1085,7 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/util/rational.h ${CMAKE_CURRENT_BINARY_DIR}/util/real_algebraic_number.h DESTINATION - ${INCLUDE_INSTALL_DIR}/cvc4/util) + ${CMAKE_INSTALL_INCLUDEDIR}/cvc4/util) # Fix include paths for all public headers. # Note: This is a temporary fix until the new C++ API is in place. diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index ae0f8015b..8c11acf3b 100644 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -51,11 +51,11 @@ target_link_libraries(cvc4-bin cvc4 cvc4parser) if(PROGRAM_PREFIX) install(PROGRAMS $<TARGET_FILE:cvc4-bin> - DESTINATION ${RUNTIME_INSTALL_DIR} + DESTINATION ${CMAKE_INSTALL_BINDIR} RENAME ${PROGRAM_PREFIX}cvc4) else() install(TARGETS cvc4-bin - DESTINATION ${RUNTIME_INSTALL_DIR}) + DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() # In order to get a fully static executable we have to make sure that we also diff --git a/src/parser/CMakeLists.txt b/src/parser/CMakeLists.txt index 393b1597a..362fdab89 100644 --- a/src/parser/CMakeLists.txt +++ b/src/parser/CMakeLists.txt @@ -99,7 +99,7 @@ target_link_libraries(cvc4parser cvc4 ${ANTLR_LIBRARIES}) target_include_directories(cvc4parser PRIVATE ${ANTLR_INCLUDE_DIR}) install(TARGETS cvc4parser EXPORT cvc4-targets - DESTINATION ${LIBRARY_INSTALL_DIR}) + DESTINATION ${CMAKE_INSTALL_LIBDIR}) # The generated lexer/parser files define some functions as # __declspec(dllexport) via the ANTLR3_API macro, which leads to lots of |