1+ include (GNUInstallDirs)
2+
13message (STATUS "${PROJECT_NAME} ${PROJECT_VERSION} CMake ${CMAKE_VERSION} " )
24
35option (ENABLE_COVERAGE "Code coverage tests" )
@@ -10,32 +12,21 @@ set(CMAKE_TLS_VERIFY true)
1012include (GNUInstallDirs)
1113
1214
13- if (BUILD_SHARED_LIBS )
14- if (WIN32 AND CMAKE_VERSION VERSION_LESS 3.21 AND ${PROJECT_NAME} _BUILD_TESTING)
15- message (STATUS "Windows with shared libs needs CMake >= 3.21 to run tests" )
16- endif ()
17- if (MSVC )
18- message (WARNING "Intel oneAPI has trouble with shared libs in general on Windows, try
19- cmake -DBUILD_SHARED_LIBS=off" )
20- endif ()
15+ if (BUILD_SHARED_LIBS AND MSVC )
16+ message (WARNING "Intel oneAPI has trouble with shared libs in general on Windows, try
17+ cmake -DBUILD_SHARED_LIBS=off" )
2118endif ()
2219
2320list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR} )
2421
2522# Rpath options necessary for shared library install to work correctly in user projects
26- set (CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX} /lib )
27- set (CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX} /lib )
23+ set (CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX} /${CMAKE_INSTALL_LIBDIR} )
24+ set (CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX} /${CMAKE_INSTALL_LIBDIR} )
2825set (CMAKE_INSTALL_RPATH_USE_LINK_PATH true )
2926
3027# Necessary for shared library with Visual Studio / Windows oneAPI
3128set (CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS true )
3229
33- if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
34- # will not take effect without FORCE
35- # CMAKE_BINARY_DIR for use from FetchContent
36- set (CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR} CACHE PATH "Install top-level directory" FORCE)
37- endif ()
38-
3930# allow CMAKE_PREFIX_PATH with ~ expand
4031if (CMAKE_PREFIX_PATH )
4132 get_filename_component (CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ABSOLUTE )
0 commit comments