I'd like to use parallel make to build libraries like ITK and VTK
which are rather time-consuming.

This simple-minded (and non portable) method works: In the
ExternalProject_Add macro, add

BUILD_COMMAND ${CMAKE_MAKE_PROGRAM} -j4

But that only works if CMAKE_MAKE_PROGRAM understands the '-j4' flag.

I can test the generator, i.e.

if("${CMAKE_GENERATOR}" STREQUAL "Unix Makefiles")
set(BUILD_COMMAND_STRING "${CMAKE_PROGRAM} -j4")
endif

and later use in the ExternalProjectAdd

BUILD_COMMAND ${BUILD_COMMAND_STRING}

But if the generator is not "Unix Makefiles" this will expand to the
empty string, with the result of suppressing builds from ever
happening.

The only solution I can imagine is to have 2 ExternalProject_Add
macros inside a conditional

if("${CMAKE_GENERATOR}" STREQUAL "Unix Makefiles")

  ExternalProjectAdd(
   BUILD_COMMAND ${CMAKE_MAKE_PROGRAM} -j4
   )
else()
  ExternalProjectAdd(
    # let the build command be the default for this generator
  )
endif()

Anyone have a better idea?
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to