You can avoid a configure and build step in ExternalProject_Add
by setting CONFIGURE_COMMAND
and BUILD_COMMAND
as empty strings.
As for installing - I generally don't bother. I like to keep all third party sources inside my own build tree, and just refer to these in my own project. However, you could probably make the install step in this case something like cmake -E copy_directory ...
.
So the full command could be:
include(ExternalProject)
ExternalProject_Add(
glm
PREFIX ${CMAKE_BINARY_DIR}/glm
GIT_REPOSITORY https://github.com/g-truc/glm.git
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory
<SOURCE_DIR>/glm ${CMAKE_BINARY_DIR}/installed/glm
LOG_DOWNLOAD ON
LOG_INSTALL ON
)
If you wanted to avoid the install step too, then also just set it to an empty string. Then to get the GLM include directory (to be used in subsequent target_include_directories
or include_directories
calls), just do e.g:
include(ExternalProject)
ExternalProject_Add(
glm
PREFIX ${CMAKE_BINARY_DIR}/glm
GIT_REPOSITORY https://github.com/g-truc/glm.git
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
LOG_DOWNLOAD ON
)
ExternalProject_Get_Property(glm source_dir)
set(GlmIncludeDir ${source_dir}/glm)
...
target_include_directories(MyTarget PRIVATE ${GlmIncludeDir})