I am using CMake FetchContent_MakeAvailable
to build a number of thirdparty depenencies from github, e.g. in the file PDFHummus.cmake
if(NOT PDFHummus_POPULATED)
Include(FetchContent)
FetchContent_Declare(
PDFHummus
GIT_REPOSITORY ${REPO}
GIT_TAG v4.6.8
DOWNLOAD_EXTRACT_TIMESTAMP FALSE
FIND_PACKAGE_ARGS
)
FetchContent_MakeAvailable(PDFHummus)
endif()
I later use this via:
add_executable(${PROJECT_NAME} ${HEADERS} ${SOURCES})
target_include_directories(${PROJECT_NAME} PRIVATE include)
target_link_libraries(${PROJECT_NAME} PRIVATE PDFHummus::PDFWriter)
link_current_target_statically(${PROJECT_NAME})
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION bin)
When I build using cmake --build --preset Debug-Windows --target=Install
my execuatble is corrctecly copied to the install/windows/bin
directory BUT all of the header files & CMake files for PDFHummus
are also copied to the install/windows
directory. This also happend for other thirdparty libraries I am building.
I assume the install()
targets from the thirdpart libraries are causing the issue and adding additional istall targets to the build/windows/install_manifest.txt
.
How can I prevent this so that only the targets I specifically name get copied?
Note I already have the following for the one thing I want in the install directory;
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION bin)