Fix cmake build with INSTALL_COZ=ON

The subdirectory libcoz was relying on the GNUInstallDirs which was
included later.

This fixes #182
This commit is contained in:
Stefan Büttner 2021-05-22 14:03:46 +02:00
parent 6dd3c3f9cd
commit 803480cfb1

View File

@ -16,6 +16,13 @@ add_compile_options(-gdwarf-3)
option(INSTALL_COZ "Enable installation of coz. (Projects embedding coz may want to turn this OFF.)" ON)
if(INSTALL_COZ)
include(GNUInstallDirs)
install(PROGRAMS coz DESTINATION bin)
install(FILES LICENSE.md DESTINATION licenses)
install(FILES cmake/coz-profilerConfig.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
endif()
add_subdirectory(libcoz)
option(BUILD_BENCHMARKS "Build benchmarks" OFF)
@ -28,9 +35,3 @@ if(BUILD_BENCHMARKS)
add_subdirectory(benchmarks)
endif()
if(INSTALL_COZ)
include(GNUInstallDirs)
install(PROGRAMS coz DESTINATION bin)
install(FILES LICENSE.md DESTINATION licenses)
install(FILES cmake/coz-profilerConfig.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
endif()