We have a similar situation and the following works well enough for us:
ExternalProject_Add(
big_external_project
...
)
set(OUTPUT_FILES files generated by the external build here)
set_source_files_properties(${OUTPUT_FILES} PROPERTIES GENERATED true)
add_library(internal_library ${OUTPUT_FILES} and whatever else it
depends on)
add_dependencies(internal_library big_external_project)
Once it has been built, the big_external_project rarely gets rebuilt
unless we do a rm -rf * in the build tree.
Magnus
On 09/19/2013 07:31 PM, Weatherby,Gerard wrote:
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
--
Magnus Johansson
Developer, Fox Technologies
--
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