Reputation: 34175
I have a header only library, that I include in my project using ExternalProject_Add
. The install command should just copy a folder. Since this should work on Windows and Linux, I tried to use file(COPY ...)
.
INSTALL_COMMAND "file(COPY ../src/include DESTINATION ../install/include)"
This gives an error since INSTALL_COMMAND
gets executed as shell command. How can I use a CMake macro instead?
Upvotes: 3
Views: 1359
Reputation: 78280
CMake has a "command mode", i.e. cmake -E ...
which provides some cross-platform filesystem commands. To see all -E
options, just run cmake -E
.
To invoke CMake itself from within a CMakeLists.txt file, you can use the variable CMAKE_COMMAND
:
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory ../src/include ../install/include
Upvotes: 6