From 32abca43f6580fca3f381e4efc23e24b80f5d11a Mon Sep 17 00:00:00 2001 From: gal kahana Date: Mon, 20 Feb 2023 23:14:49 +0200 Subject: [PATCH] Install inconveniences (#196) * exclude tests when included * add component to includes install, to match the libs install, otherwise they are not copied on component install * nl * and lets make it a release --- CMakeLists.txt | 12 ++++++++---- FreeType/CMakeLists.txt | 3 ++- LibAesgm/CMakeLists.txt | 3 ++- LibJpeg/CMakeLists.txt | 3 ++- LibPng/CMakeLists.txt | 1 + LibTiff/CMakeLists.txt | 3 ++- PDFWriter/CMakeLists.txt | 1 + PDFWriterTesting/CMakeLists.txt | 6 ------ ZLib/CMakeLists.txt | 3 ++- 9 files changed, 20 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 73044646..f6b06941 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.15) # Soname # MAJOR is incremented when symbols are removed or changed in an incompatible way # MINOR is incremented when new symbols are added -project(PDFHummus VERSION 4.5.2) +project(PDFHummus VERSION 4.5.3) option(USE_BUNDLED "Whether to use bundled libraries" TRUE) @@ -153,9 +153,13 @@ endif(NOT USE_BUNDLED) ADD_SUBDIRECTORY(PDFWriter) -enable_testing() -ADD_SUBDIRECTORY(PDFWriterTesting) - +if(PROJECT_IS_TOP_LEVEL) + # avoid installing the testing lib altogether when included in another project. + # it's annoying when in parent all, and more annoying to then get the tests added + # to the parent project ctest. + enable_testing() + ADD_SUBDIRECTORY(PDFWriterTesting) +endif(PROJECT_IS_TOP_LEVEL) include(InstallRequiredSystemLibraries) set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") diff --git a/FreeType/CMakeLists.txt b/FreeType/CMakeLists.txt index 99b59aee..a3e451fa 100644 --- a/FreeType/CMakeLists.txt +++ b/FreeType/CMakeLists.txt @@ -77,6 +77,7 @@ install(TARGETS FreeType ) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include DESTINATION include/FreeType + COMPONENT dependencies FILES_MATCHING PATTERN "*.h" -) \ No newline at end of file +) diff --git a/LibAesgm/CMakeLists.txt b/LibAesgm/CMakeLists.txt index 6ff89204..ff246d63 100644 --- a/LibAesgm/CMakeLists.txt +++ b/LibAesgm/CMakeLists.txt @@ -37,6 +37,7 @@ install(TARGETS LibAesgm ) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION include + COMPONENT dependencies FILES_MATCHING PATTERN "*.h" -) \ No newline at end of file +) diff --git a/LibJpeg/CMakeLists.txt b/LibJpeg/CMakeLists.txt index fc763fd6..63f47277 100644 --- a/LibJpeg/CMakeLists.txt +++ b/LibJpeg/CMakeLists.txt @@ -78,6 +78,7 @@ install(TARGETS LibJpeg ) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION include + COMPONENT dependencies FILES_MATCHING PATTERN "*.h" -) \ No newline at end of file +) diff --git a/LibPng/CMakeLists.txt b/LibPng/CMakeLists.txt index 02e31d75..d03364cc 100644 --- a/LibPng/CMakeLists.txt +++ b/LibPng/CMakeLists.txt @@ -52,6 +52,7 @@ install(TARGETS LibPng ) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION include + COMPONENT dependencies FILES_MATCHING PATTERN "*.h" ) diff --git a/LibTiff/CMakeLists.txt b/LibTiff/CMakeLists.txt index c9316d1c..9be23124 100644 --- a/LibTiff/CMakeLists.txt +++ b/LibTiff/CMakeLists.txt @@ -95,6 +95,7 @@ install(TARGETS LibTiff ) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION include + COMPONENT dependencies FILES_MATCHING PATTERN "*.h" -) \ No newline at end of file +) diff --git a/PDFWriter/CMakeLists.txt b/PDFWriter/CMakeLists.txt index 6f6e5cd1..d5b88e0d 100644 --- a/PDFWriter/CMakeLists.txt +++ b/PDFWriter/CMakeLists.txt @@ -421,6 +421,7 @@ install(TARGETS PDFWriter install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION include + COMPONENT libraries FILES_MATCHING PATTERN "*.h" ) diff --git a/PDFWriterTesting/CMakeLists.txt b/PDFWriterTesting/CMakeLists.txt index 3fd2dd20..0b664b01 100644 --- a/PDFWriterTesting/CMakeLists.txt +++ b/PDFWriterTesting/CMakeLists.txt @@ -81,12 +81,6 @@ add_executable (PDFWriterTesting PDFCommentWriter.cpp ) -# (adding to all target only if project is built independently, so that FetchContent imports that build from source -# wont build this unnecessary step unless asked for explicitly) -set_target_properties(PDFWriterTesting - PROPERTIES EXCLUDE_FROM_ALL $> -) - target_link_libraries (PDFWriterTesting PDFWriter) if(APPLE) diff --git a/ZLib/CMakeLists.txt b/ZLib/CMakeLists.txt index ee11eb26..589bf30c 100644 --- a/ZLib/CMakeLists.txt +++ b/ZLib/CMakeLists.txt @@ -56,6 +56,7 @@ install(TARGETS Zlib ) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION include + COMPONENT dependencies FILES_MATCHING PATTERN "*.h" -) \ No newline at end of file +)