Skip to content

Commit ecfc1f2

Browse files
committed
CMakeLists: use standard install directory variables
Use the variables provided by cmake for install directories to standardize across build systems. The hard-coded /lib appended to exec_prefix does not necessarily match automake's $(libdir) (especially in multilib scenarios), so depending on whether you're using cmake or automake, you could actually end up with different pkg-config files given the right configuration, in addition to files being installed in different directories.
1 parent 952bf2d commit ecfc1f2

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

‎CMakeLists.txt‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ include(CTest)
6969
#include("${CppUTestRootDirectory}/cmake/Modules/CheckFunctionExists.cmake")
7070
include("${CppUTestRootDirectory}/cmake/Modules/CppUTestBuildTimeDiscoverTests.cmake")
7171
include("${CppUTestRootDirectory}/cmake/Modules/CppUTestNormalizeTestOutputLocation.cmake")
72+
include(GNUInstallDirs)
7273

7374
configure_file (
7475
"${PROJECT_SOURCE_DIR}/config.h.cmake"
@@ -91,8 +92,8 @@ if (TESTS)
9192
endif (EXTENSIONS)
9293
endif (TESTS)
9394

94-
set (INCLUDE_INSTALL_DIR "include")
95-
set (LIB_INSTALL_DIR "lib")
95+
set (INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}")
96+
set (LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}")
9697
set (INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
9798

9899
# Pkg-config file.

‎src/CppUTest/CMakeLists.txt‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,5 @@ endif (WIN32)
6868
install(FILES ${CppUTest_headers} DESTINATION include/CppUTest)
6969
install(TARGETS CppUTest
7070
EXPORT CppUTestTargets
71-
RUNTIME DESTINATION bin
72-
LIBRARY DESTINATION lib
73-
ARCHIVE DESTINATION lib)
71+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
72+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})

‎src/CppUTestExt/CMakeLists.txt‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,5 @@ target_link_libraries(CppUTestExt ${CPPUNIT_EXTERNAL_LIBRARIES})
4343
install(FILES ${CppUTestExt_headers} DESTINATION include/CppUTestExt)
4444
install(TARGETS CppUTestExt
4545
EXPORT CppUTestTargets
46-
RUNTIME DESTINATION bin
47-
LIBRARY DESTINATION lib
48-
ARCHIVE DESTINATION lib)
46+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
47+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})

0 commit comments

Comments
 (0)