Skip to content

Commit a1232cc

Browse files
committed
minor tweak to cmake
1 parent e06e8a1 commit a1232cc

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

CMakeLists.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,15 @@ else()
4747
endif()
4848

4949

50+
# GNUInstallDirs defines CMAKE_INSTALL_INCLUDEDIR (and friends), which is used
51+
# below in the INSTALL_INTERFACE include path. It must be included before that
52+
# expansion, otherwise the variable is empty and the exported target ends up
53+
# with a bogus "/fastpfor" include directory that breaks find_package().
54+
include(GNUInstallDirs)
55+
5056
# library target
5157
add_library(FastPFOR STATIC)
52-
target_include_directories(FastPFOR PUBLIC
58+
target_include_directories(FastPFOR PUBLIC
5359
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/headers>
5460
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/fastpfor>
5561
)
@@ -193,8 +199,7 @@ if(FASTPFOR_WITH_TEST)
193199
enable_testing()
194200
add_test("FastPFOR_unittest" FastPFOR_unittest)
195201
endif()
196-
197-
include(GNUInstallDirs)
202+
198203
install(TARGETS FastPFOR
199204
EXPORT FastPFORExport
200205
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"

0 commit comments

Comments
 (0)