We have an external library which is not easily "cmakeable" and takes a long 
time to compile. We have a static copy of the source in our SCCS, so we don't 
need to fetch etc.

What we'd like to have happen is have the code compile if and only if the 
output libraries are not present.  The best I've come up with is:
               add_custom_command(OUTPUT ${CHOMBO_LIBS_2D}
                              PRE_BUILD
                              COMMAND ${CHOMBO_BUILD_CMD}
#                            DEPENDS don't add depends line ... causes 
recompiling of Chombo every time
                              WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/Chombo/lib
               )
               # include the Chombo libraries as "source" file to trigger 
building them via "add_custom_command"
               # if they don't exist
               add_executable(${EXE_2D} ${CHOMBO_LIBS_2D} ${SRC_FILES})

where CHOMBO_LIBS_2D are the libraries generated by CHOMBO_BUILD_CMD. The 
libraries link in the source tree.

This works, mostly. It doesn't work with parallel builds (make -j9)

I tried looking at ExternalProject_Add but didn't seem how to tell it what 
output is generated by the command (and hence I'm not sure how / if it can be 
used to only make if the libraries are missing).

Gerard Weatherby
Appllication Architect
Virtual Cell, Center for Cell Analysis and Modeling (CCAM)
University of Connecticut Health Center
860-679-2065

--

Powered by www.kitware.com

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

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

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

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

Reply via email to