I'm making a CMAKE file with an external project. I'm following the example here: CMake ExternalProject_Add() and FindPackage()
However, I have a problem. When I call cmake, I use cmake -G "MinGW Makefiles" ..
. Unfortunately the -G parameter doesn't seem to be passed into the rescan target. How can I relay applicable Cmake commands to any rescan?
I think this is the line I need to change
add_custom_target(Rescan ${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR} DEPENDS Eigen3)
Here is the CMakeLists.txt:
find_package( Dep1 )
include (ExternalProject)
ExternalProject_Add (
Dep1
SVN_REPOSITORY https://svn.company.nl/svn/Dep1-trunk
SVN_REVISION -rHEAD
TIMEOUT 10
)
if (NOT Dep1_FOUND )
add_custom_target(Rescan ${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR} DEPENDS Dep1)
else (NOT Dep1_FOUND)
add_custom_target(Rescan)
endif (NOT Dep1_FOUND)
#build app
add_executable( Testapp main.cpp )
add_dependencies( Testapp Rescan )
if (${Dep1_FOUND})
target_include_directories( Testapp PUBLIC ${Dep1_INCLUDE_DIR} )
target_link_libraries( Testapp ${Dep1_LIBRARY} )
endif (${Dep1_FOUND})
#Install package
install(TARGETS Testapp EXPORT ${PROJECT_NAME}Targets
RUNTIME DESTINATION bin
)