diff --git a/CMakeLists.txt b/CMakeLists.txt index 7c23b792a3bfa7370d34de8b32bca33fd4803485..96059ffa2a5734b2d05387e8439fa4cd9d7fdcc4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,6 +56,28 @@ install( COMPONENT Development DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} ) + + +# Export targets from the *build* tree for use by outside projects. +# +# INFO: +# Thus, this project can be used by other projects without being installed. +# This is useful for development: you can build a child projet without an +# install path. +# For example: +# while generating GeoModel projects with CMake as Xcode project on macOS, +# after having built GeoModelCore, you can use that to build GeoModelIO without +# the need of an installation step, by simply prepend 'GeoModelCore_DIR' as this: +# $ GeoModelCore_DIR=../b_core/CMakeFiles cmake -G Xcode ../../GeoModelIO +# which is useful when generating projects +# that needs to be built with Xcode. Xcode in fact does not handle well the install +# folder generated by CMake: sometimes the content of that is not updated when +# updating the code, which results in keeping running the same old code even if +# we modified our source code. +# export(EXPORT ${PROJECT_NAME}-export NAMESPACE "${PROJECT_NAME}::" FILE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PROJECT_NAME}Config.cmake) +export(TARGETS GeoGenericFunctions GeoModelKernel NAMESPACE "${PROJECT_NAME}::" FILE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PROJECT_NAME}Targets.cmake) + + # Set up the packaging of the project using CPack. include( GeoModelCorePackaging ) @@ -79,9 +101,10 @@ if (DOXYGEN_FOUND) # request to configure the file configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY) - message("Doxygen build started") - # note the option ALL which allows to build the docs together with the application + # note: + # - `make doc` builds the Doxygen docs on request + # - `make all` allows to build the docs together with the application add_custom_target( doc COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}