[CMake] ExternalProject_Add : set the location of CMakeLists.txt

Konstantin Podsvirov konstantin at podsvirov.pro
Tue Oct 25 13:54:35 EDT 2016


Hello again.

25.10.2016, 20:31, "Konstantin Podsvirov" <konstantin at podsvirov.pro>:
> Hello, Benjamin.
>
> 25.10.2016, 19:41, "Benjamin Ballet via CMake" <cmake at cmake.org>:
>>  Hi,
>>
>>  I'm trying to get GLEW (https://github.com/nigels-com/glew) with ExternalProject_Add
>>  It's buildable with cmake but the CMakeLists.txt is in build/cmake directory.
>>
>>  Is there a way to specify the directory of the CMakeLists.txt file ?
>>
>>  If I change SOURCE_DIR it will only clone the repo in SOURCE_DIR and still run the cmake command in repo root.
>>
>>  --
>>  Benjamin BALLET
>>  Ingénieur R&D
>>
>>  ACTIVISU
>>  19, rue Klock - 92110 Clichy
>>>  Standard Tél :  01 44 69 37 37
>>>  www.activisu.com
>>  ,--
>
> Try it:
>
> ExternalProject_Add(
>   ...
>   SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/source
>   ...
>   CONFIGURE_COMMAND ${CMAKE_COMMAND} [additional args...] ${CMAKE_CURRENT_BINARY_DIR}/source/build/cmake
>   ...)


Or try it:

ExternalProject_Add(
  ...
  SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/source
  ...
  CONFIGURE_COMMAND ${CMAKE_COMMAND} [additional args...]
   -DCMAKE_GENERATOR=${CMAKE_GENERATOR}
   -DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM}
   -DCMAKE_GENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET}
    ${CMAKE_CURRENT_BINARY_DIR}/source/build/cmake
  ...)

--
Regards,
Konstantin Podsvirov


More information about the CMake mailing list