From 4f71d7035d32e8f74d9b13e0d6a9c0ab4a58062d Mon Sep 17 00:00:00 2001 From: Alexey Sheplyakov Date: Wed, 18 Dec 2019 14:52:17 +0400 Subject: [PATCH] Use "modern" CMake facilities to manage includes and libs * Use target_link_libraries to specify dependencies (include paths, compiler options, etc) * Export targets and provide `ginac-config.cmake` so the following `CMakeLists.txt` is enough to build a program using GiNaC: cmake_minimum_required(VERSION 3.1) project(foo) find_package(ginac REQUIRED) add_executable(foo foo.cpp) target_link_libraries(foo PRIVATE ginac::ginac) * GiNaC can be included as a (CMake) subproject. One can put GiNaC sources (either from git or a tarball) into a subdirectory (say, `ginac`) and use the following CMakeLists.txt to build everything: cmake_minimum_required(VERSION 3.1) project(foo) add_subdirectory(ginac) add_executable(foo foo.cpp) target_link_libraries(foo PRIVATE ginac::ginac) --- CMakeLists.txt | 106 +++++++++++++++--------------------- Makefile.am | 1 + check/CMakeLists.txt | 5 +- cmake/ginac-config.cmake.in | 9 +++ cmake/modules/FindCLN.cmake | 23 ++++++++ doc/examples/CMakeLists.txt | 29 +++++++--- ginac.pc.cmake | 6 +- ginac/CMakeLists.txt | 32 ++++++++--- ginsh/CMakeLists.txt | 15 ++--- tools/CMakeLists.txt | 8 +-- 10 files changed, 136 insertions(+), 98 deletions(-) create mode 100644 cmake/ginac-config.cmake.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 20ce8e19..aa221ff7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,15 +1,15 @@ cmake_minimum_required(VERSION 3.1) -set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules") +set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") project(GiNaC) -file(STRINGS ${CMAKE_SOURCE_DIR}/ginac/version.h _ginac_vinfo REGEX "^#define[\t ]+GINACLIB_.*_VERSION.*") +file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/ginac/version.h _ginac_vinfo REGEX "^#define[\t ]+GINACLIB_.*_VERSION.*") string(REGEX REPLACE "^.*GINACLIB_MAJOR_VERSION[ \t]+([0-9]+).*" "\\1" GINAC_MAJOR_VERSION "${_ginac_vinfo}") string(REGEX REPLACE "^.*GINACLIB_MINOR_VERSION[ \t]+([0-9]+).*" "\\1" GINAC_MINOR_VERSION "${_ginac_vinfo}") string(REGEX REPLACE "^.*GINACLIB_MICRO_VERSION[ \t]+([0-9]+).*" "\\1" GINAC_MICRO_VERSION "${_ginac_vinfo}") set(GINAC_VERSION "${GINAC_MAJOR_VERSION}.${GINAC_MINOR_VERSION}.${GINAC_MICRO_VERSION}") # Library versioning info -file(STRINGS ${CMAKE_SOURCE_DIR}/ginac/version.h _ginac_vinfo REGEX "^#define[\t ]+GINAC_LT_.*") +file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/ginac/version.h _ginac_vinfo REGEX "^#define[\t ]+GINAC_LT_.*") string(REGEX REPLACE "^.*GINAC_LT_CURRENT[ \t]+([0-9]+).*" "\\1" ginac_lt_current "${_ginac_vinfo}") string(REGEX REPLACE "^.*GINAC_LT_AGE[ \t]+([0-9]+).*" "\\1" ginac_lt_age "${_ginac_vinfo}") string(REGEX REPLACE "^.*GINAC_LT_REVISION[ \t]+([0-9]+).*" "\\1" ginac_lt_revision "${_ginac_vinfo}") @@ -17,71 +17,39 @@ string(REGEX REPLACE "^.*GINAC_LT_REVISION[ \t]+([0-9]+).*" "\\1" ginac_lt_revis math(EXPR ginaclib_soversion "${ginac_lt_current} - ${ginac_lt_age}") set(ginaclib_version ${ginaclib_soversion}.${ginac_lt_age}.${ginac_lt_revision}) +include(GNUInstallDirs) + # make check enable_testing() -add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}) -add_custom_target(test_suite) +if (NOT TARGET check) + add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}) +endif() +if (NOT TARGET test_suite) + add_custom_target(test_suite) +endif() if (WIN32) if (NOT DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) endif() endif() # make info -add_custom_target(info ALL) -add_custom_target(html) -add_custom_target(pdf) +if (NOT TARGET info) + add_custom_target(info ALL) +endif() +if (NOT TARGET html) + add_custom_target(html) +endif() +if (NOT TARGET pdf) + add_custom_target(pdf) +endif() set (CMAKE_CXX_STANDARD 11) find_package(CLN 1.2.2 REQUIRED) -include_directories(${CLN_INCLUDE_DIR}) include(CheckIncludeFile) check_include_file("unistd.h" HAVE_UNISTD_H) -include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/ginac) - -# This macro implements some very special logic how to deal with the cache. -# By default the various install locations inherit their value from their -#"parent" variable, so if you set CMAKE_INSTALL_PREFIX, then -# EXEC_INSTALL_PREFIX, BIN_INSTALL_DIR, LIB_INSTALL_DIR, etc will calculate -# their value by appending subdirs to CMAKE_INSTALL_PREFIX. -# This would work just fine without using the cache. -# But if somebody wants e.g. a different EXEC_INSTALL_PREFIX this value -# has to go into the cache, otherwise it will be forgotten on the next cmake -# run. Once a variable is in the cache, it doesn't depend on its "parent" -# variables anymore and you can only change it by editing it directly. -# This macro helps in this regard, because as long as you don't set one -# of the variables explicitly to some location, the value will be computed -# from parents of the variable in question. So modifying CMAKE_INSTALL_PREFIX -# later on will have the desired effect. -# But once you decide to set e.g. EXEC_INSTALL_PREFIX to some special -# location this will go into the cache and it will no longer depend on -# CMAKE_INSTALL_PREFIX. - -macro(_set_fancy _var _value _comment) - set(predefinedvalue "${_value}") - if ("${CMAKE_INSTALL_PREFIX}" STREQUAL "${GINAC_INSTALL_DIR}" AND DEFINED GINAC_${_var}) - set(predefinedvalue "${GINAC_${_var}}") - endif() - if (NOT DEFINED ${_var}) - set(${_var} ${predefinedvalue}) - else() - set(${_var} "${${_var}}" CACHE PATH "${_comment}") - endif() -endmacro(_set_fancy) - -_set_fancy(EXEC_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" - "Base directory for libraries and executables") -_set_fancy(LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib" - "Libraries installation directory") -_set_fancy(BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" - "Binaries installation directory") -_set_fancy(SHARE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/share" - "Base directory for architecture independent files") -_set_fancy(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" - "Headers installation directory") - if (NOT DEFINED BUILD_SHARED_LIBS) if (NOT MSVC) set(BUILD_SHARED_LIBS true) @@ -105,7 +73,7 @@ set(_wl_rpath "${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG}") # rpath for the pkg-config meta-data. set(_ginaclib_rpath "${_wl_rpath}${_ginac_rpath_reloc}") -list(FIND CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "${LIB_INSTALL_DIR}" isSystemDir) +list(FIND CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_FULL_LIBDIR}" isSystemDir) if ("${isSystemDir}" STREQUAL "-1") list(APPEND _ginaclib_rpath "${_wl_rpath}\${libdir}") endif() @@ -116,12 +84,12 @@ if (NOT CMAKE_SKIP_RPATH) endif() endif() -configure_file(${CMAKE_SOURCE_DIR}/ginac.pc.cmake ${CMAKE_BINARY_DIR}/ginac.pc @ONLY) -install(FILES ${CMAKE_BINARY_DIR}/ginac.pc DESTINATION "${LIB_INSTALL_DIR}/pkgconfig") +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ginac.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/ginac.pc @ONLY) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ginac.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") # rpath for libginac.so itself, ginsh, and friends set(_ginac_rpath ${_ginac_rpath_reloc}) -foreach(_d ${CLN_LIBRARY_DIRS} ${LIB_INSTALL_DIR}) +foreach(_d ${CLN_LIBRARY_DIRS} ${CMAKE_INSTALL_FULL_LIBDIR}) list(FIND CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "${_d}" isSystemDir) if ("${isSystemDir}" STREQUAL "-1") list(APPEND _ginac_rpath "${_d}") @@ -137,16 +105,16 @@ if (NOT DEFINED CMAKE_INSTALL_RPATH) set(CMAKE_INSTALL_RPATH ${ginac_rpath}) endif() if (APPLE AND NOT DEFINED CMAKE_INSTALL_NAME_DIR) - set(CMAKE_INSTALL_NAME_DIR ${LIB_INSTALL_DIR}) + set(CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_FULL_LIBDIR}) endif() -list(FIND CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "${LIB_INSTALL_DIR}" isSystemDir) +list(FIND CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_FULL_LIBDIR}" isSystemDir) if ("${isSystemDir}" STREQUAL "-1") string(REPLACE ":" ";" _install_rpath "${CMAKE_INSTALL_RPATH}") - list(FIND _install_rpath "${LIB_INSTALL_DIR}" _is_rpath_consistent) + list(FIND _install_rpath "${CMAKE_INSTALL_FULL_LIBDIR}" _is_rpath_consistent) if ("${_is_rpath_consistent}" STREQUAL "-1") message(WARNING "the libginac.so library will be installed into " - "a non-standard directory (${LIB_INSTALL_DIR}), " + "a non-standard directory (${CMAKE_INSTALL_FULL_LIBDIR}), " "however, the rpath (${_install_rpath}) " "does not contain that directory. Most likely " "things won't work without extra configuration " @@ -154,6 +122,23 @@ if ("${isSystemDir}" STREQUAL "-1") endif() endif() +include(CMakePackageConfigHelpers) +write_basic_package_version_file( + ${CMAKE_CURRENT_BINARY_DIR}/ginac-config-version.cmake + VERSION ${GINAC_VERSION} + COMPATIBILITY AnyNewerVersion +) + +configure_package_config_file(${CMAKE_CURRENT_LIST_DIR}/cmake/ginac-config.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/ginac-config.cmake + INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ginac +) + +install(FILES + ${CMAKE_CURRENT_BINARY_DIR}/ginac-config.cmake + ${CMAKE_CURRENT_BINARY_DIR}/ginac-config-version.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ginac +) include(FindFLEX) include(FindBISON) @@ -183,7 +168,6 @@ endif() configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) -add_definitions(-DHAVE_CONFIG_H) if (NOT LIBEXECDIR) set (LIBEXECDIR "${CMAKE_INSTALL_PREFIX}/libexec") diff --git a/Makefile.am b/Makefile.am index b651383c..950d12d5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -11,6 +11,7 @@ CMAKE_FILES = CMakeLists.txt \ ginac.pc.cmake \ config.cmake.in \ INSTALL.CMake \ + cmake/ginac-config.cmake.in \ cmake/modules/FindCLN.cmake \ cmake/modules/FindReadline.cmake \ cmake/modules/FindGiNaC.cmake \ diff --git a/check/CMakeLists.txt b/check/CMakeLists.txt index 544c412e..caabbfc3 100644 --- a/check/CMakeLists.txt +++ b/check/CMakeLists.txt @@ -1,5 +1,3 @@ -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../ginac) -add_definitions(-DIN_GINAC) set(ginac_tests check_numeric @@ -70,7 +68,7 @@ macro(add_ginac_test thename) set(${thename}_sources ${thename}.cpp ${${thename}_extra_src}) endif() add_executable(${thename} EXCLUDE_FROM_ALL ${${thename}_sources}) - target_link_libraries(${thename} ginac ${LIBDL_LIBRARIES}) + target_link_libraries(${thename} ginac::ginac) add_dependencies(test_suite ${thename}) add_dependencies(check ${thename}) add_test(NAME ${thename} COMMAND $) @@ -79,6 +77,7 @@ endmacro() macro(add_ginac_timing thename) set(${thename}_extra_src timer.cpp randomize_serials.cpp) add_ginac_test(${thename}) + target_compile_definitions(${thename} PRIVATE HAVE_CONFIG_H) endmacro() set(check_matrices_extra_src genex.cpp) diff --git a/cmake/ginac-config.cmake.in b/cmake/ginac-config.cmake.in new file mode 100644 index 00000000..ba6e5b39 --- /dev/null +++ b/cmake/ginac-config.cmake.in @@ -0,0 +1,9 @@ +get_filename_component(ginac_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) +include(CMakeFindDependencyMacro) +find_package(CLN 1.2.2 REQUIRED) + +if (NOT TARGET ginac::ginac) + include("${ginac_CMAKE_DIR}/ginac-targets.cmake") +endif() + +set(ginac_LIBRARIES ginac::ginac) diff --git a/cmake/modules/FindCLN.cmake b/cmake/modules/FindCLN.cmake index ee5fc5ca..1f07bc9a 100644 --- a/cmake/modules/FindCLN.cmake +++ b/cmake/modules/FindCLN.cmake @@ -116,3 +116,26 @@ include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(CLN REQUIRED_VARS CLN_LIBRARIES CLN_INCLUDE_DIR VERSION_VAR CLN_VERSION) +if (CLN_FOUND AND NOT TARGET cln::cln) + set(_found_shared_libcln FALSE) + get_filename_component(_libcln_suffix ${CLN_LIBRARIES} EXT) + if (_libcln_suffix STREQUAL ${CMAKE_STATIC_LIBRARY_SUFFIX}) + # XXX: msvc uses the same suffix for both static and import libraries + add_library(cln::cln STATIC IMPORTED) + else() + set(_found_shared_libcln TRUE) + add_library(cln::cln SHARED IMPORTED) + endif() + set_target_properties(cln::cln PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${CLN_INCLUDE_DIR} + ) + if (WIN32 AND _found_shared_libcln) + set_target_properties(cln::cln PROPERTIES + IMPORTED_IMPLIB ${CLN_LIBRARIES} + ) + else() + set_target_properties(cln::cln PROPERTIES + IMPORTED_LOCATION ${CLN_LIBRARIES} + ) + endif() +endif() diff --git a/doc/examples/CMakeLists.txt b/doc/examples/CMakeLists.txt index afdc67d2..ea5f64d7 100644 --- a/doc/examples/CMakeLists.txt +++ b/doc/examples/CMakeLists.txt @@ -1,23 +1,34 @@ -add_info_file(ginac-examples) +cmake_minimum_required(VERSION 3.1) -add_definitions(-DIN_GINAC) -include_directories(${CMAKE_SOURCE_DIR}/ginac ${CMAKE_BUILD_DIR}/ginac) +project(GiNaC_examples) + +if (TARGET ginac) + add_info_file(ginac-examples) +endif() + +if (NOT TARGET ginac AND EXISTS ${CMAKE_CURRENT_LIST_DIR}/ginac/CMakeLists.txt) + add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/ginac ${CMAKE_CURRENT_BINARY_DIR}/ginac) +endif() + +if (NOT TARGET ginac) + find_package(ginac REQUIRED 1.7.0) +endif() add_executable(archive1 archive1.cpp) -target_link_libraries(archive1 ginac ${LIBDL_LIBRARIES}) +target_link_libraries(archive1 ginac::ginac) add_executable(compile1 compile1.cpp) -target_link_libraries(compile1 ginac ${LIBDL_LIBRARIES}) +target_link_libraries(compile1 ginac::ginac) # XXX: compile2 example uses the Cuba library (http://www.feynarts.de/cuba) # add_executable(compile2 compile2.cpp) -# target_link_libraries(compile2 ginac ${LIBDL_LIBRARIES}) +# target_link_libraries(compile2 ginac::ginac) add_executable(compile3 compile3.cpp) -target_link_libraries(compile3 ginac ${LIBDL_LIBRARIES}) +target_link_libraries(compile3 ginac::ginac) add_executable(mystring mystring.cpp) -target_link_libraries(mystring ginac ${LIBDL_LIBRARIES}) +target_link_libraries(mystring ginac::ginac) add_executable(derivative derivative.cpp) -target_link_libraries(derivative ginac ${LIBDL_LIBRARIES}) +target_link_libraries(derivative ginac::ginac) diff --git a/ginac.pc.cmake b/ginac.pc.cmake index 4b168bea..18543ecf 100644 --- a/ginac.pc.cmake +++ b/ginac.pc.cmake @@ -1,7 +1,7 @@ prefix=@CMAKE_INSTALL_PREFIX@ -exec_prefix=@EXEC_INSTALL_PREFIX@ -libdir=@LIB_INSTALL_DIR@ -includedir=@INCLUDE_INSTALL_DIR@ +exec_prefix=@CMAKE_INSTALL_PREFIX@ +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ Name: GiNaC Description: C++ library for symbolic calculations diff --git a/ginac/CMakeLists.txt b/ginac/CMakeLists.txt index 98bd89b8..08666551 100644 --- a/ginac/CMakeLists.txt +++ b/ginac/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) set(ginaclib_sources add.cpp @@ -147,12 +146,21 @@ set(ginaclib_private_headers ) add_library(ginac ${ginaclib_sources}) -add_definitions(-DLIBEXECDIR="${LIBEXECDIR}/") +add_library(ginac::ginac ALIAS ginac) set_target_properties(ginac PROPERTIES SOVERSION ${ginaclib_soversion} VERSION ${ginaclib_version}) -target_link_libraries(ginac ${CLN_LIBRARIES}) -include_directories(${CMAKE_SOURCE_DIR}/ginac) +target_compile_definitions(ginac + PUBLIC $ + PRIVATE -DLIBEXECDIR="${LIBEXECDIR}/" HAVE_CONFIG_H +) +target_link_libraries(ginac PUBLIC cln::cln ${LIBDL_LIBRARIES}) +target_include_directories(ginac PUBLIC + $ + $ + $ + $ +) if (WIN32 AND CMAKE_COMPILER_IS_GNUCXX AND BUILD_SHARED_LIBS) set_target_properties(ginac PROPERTIES @@ -167,10 +175,18 @@ if (NOT BUILD_SHARED_LIBS) set_target_properties(ginac PROPERTIES PREFIX "lib") endif() -install(TARGETS ginac LIBRARY DESTINATION "${LIB_INSTALL_DIR}" - RUNTIME DESTINATION "${BIN_INSTALL_DIR}" - ARCHIVE DESTINATION "${LIB_INSTALL_DIR}") -install(FILES ${ginaclib_public_headers} DESTINATION "${INCLUDE_INSTALL_DIR}/ginac") +install(TARGETS ginac + EXPORT ginac-exports + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" +) +install(FILES ${ginaclib_public_headers} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/ginac") +install(EXPORT ginac-exports + FILE ginac-targets.cmake + NAMESPACE ginac:: + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ginac +) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/function.h diff --git a/ginsh/CMakeLists.txt b/ginsh/CMakeLists.txt index 46de38bf..d90dd8e1 100644 --- a/ginsh/CMakeLists.txt +++ b/ginsh/CMakeLists.txt @@ -1,9 +1,3 @@ -include_directories( - ${CMAKE_CURRENT_SOURCE_DIR}/../ginac - ${CMAKE_CURRENT_BINARY_DIR}/../ginac - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_BINARY_DIR}) -add_definitions(-DIN_GINAC) bison_target(ginsh_parser ginsh_parser.ypp @@ -34,8 +28,9 @@ set(ginsh_DISTRIB ginsh_fcn_help.py ginsh_op_help.py ) +set(ginsh_include_directories ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) if (READLINE_FOUND) - include_directories(${READLINE_INCLUDE_DIRS}) + set(ginsh_include_directories ${ginsh_include_directories} ${READLINE_INCLUDE_DIRS}) endif() add_custom_command( @@ -61,5 +56,7 @@ if (READLINE_FOUND) endif() add_executable(ginsh ${ginsh_SOURCES} ${ginsh_HEADERS}) -target_link_libraries(ginsh ginac ${ginsh_extra_libs} ${LIBDL_LIBRARIES}) -install(TARGETS ginsh RUNTIME DESTINATION "${BIN_INSTALL_DIR}") +target_link_libraries(ginsh ginac::ginac ${ginsh_extra_libs}) +target_include_directories(ginsh PRIVATE ${ginsh_include_directories}) +target_compile_definitions(ginsh PRIVATE HAVE_CONFIG_H) +install(TARGETS ginsh RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index f444dcfe..0c787ce6 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -1,9 +1,7 @@ -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../ginac) -add_definitions(-DIN_GINAC) add_executable(viewgar viewgar.cpp) -target_link_libraries(viewgar ginac ${LIBDL_LIBRARIES}) -install(TARGETS viewgar RUNTIME DESTINATION "${BIN_INSTALL_DIR}") +target_link_libraries(viewgar ginac::ginac) +install(TARGETS viewgar RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") if (CMAKE_COMPILER_IS_GNUCC) set (CC gcc) @@ -12,5 +10,5 @@ if (CMAKE_COMPILER_IS_GNUCC) "${CMAKE_CURRENT_BINARY_DIR}/ginac-excompiler" ) - install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/ginac-excompiler DESTINATION "${LIBEXECDIR}") + install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/ginac-excompiler DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}") endif (CMAKE_COMPILER_IS_GNUCC) -- 2.45.0