From 30999a6898849ddcee829f3081532fe8369c2b45 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Mon, 23 Nov 2015 12:39:07 -0200 Subject: [PATCH] Move run on build dir code out of the main cmake Signed-off-by: Tomaz Canabrava --- CMakeLists.txt | 31 +------------------------------ cmake/Modules/RunOnBuildDir.cmake | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 30 deletions(-) create mode 100644 cmake/Modules/RunOnBuildDir.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index c4ce04be3..904bab29a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,6 +97,7 @@ include(cmake/Modules/HandleFindGrantlee.cmake) include(cmake/Modules/HandleFtdiSupport.cmake) include(cmake/Modules/HandleUserManual.cmake) include(cmake/Modules/HandleVersionGeneration.cmake) +include(cmake/Modules/RunOnBuildDir.cmake) pkg_config_library(LIBXML libxml-2.0 REQUIRED) pkg_config_library(LIBSQLITE3 sqlite3 REQUIRED) @@ -289,36 +290,6 @@ endif() add_executable(export-html EXCLUDE_FROM_ALL export-html.cpp ${SUBSURFACE_RESOURCES}) target_link_libraries(export-html subsurface_corelib ${SUBSURFACE_LINK_LIBRARIES}) -# install a few things so that one can run Subsurface from the build -# directory -add_custom_target(themeLink ALL - COMMAND - rm -f ${CMAKE_BINARY_DIR}/theme && - ln -s ${CMAKE_SOURCE_DIR}/theme ${CMAKE_BINARY_DIR}/theme -) -if(NOT NO_PRINTING) - add_custom_target(printing_templatesLink ALL - COMMAND - rm -f ${CMAKE_BINARY_DIR}/printing_templates && - ln -s ${CMAKE_SOURCE_DIR}/printing_templates ${CMAKE_BINARY_DIR}/printing_templates - ) -endif() -if(NOT NO_DOCS) - add_custom_target( - documentationLink ALL - COMMAND - mkdir -p ${CMAKE_BINARY_DIR}/Documentation/ && - rm -rf ${CMAKE_BINARY_DIR}/Documentation/images && - ln -s ${CMAKE_SOURCE_DIR}/Documentation/images ${CMAKE_BINARY_DIR}/Documentation/images - ) - add_custom_target( - documentation ALL - COMMAND - ${CMAKE_MAKE_PROGRAM} -C ${CMAKE_SOURCE_DIR}/Documentation OUT=${CMAKE_BINARY_DIR}/Documentation/ doc - DEPENDS documentationLink - ) -endif() - # install Subsurface # first some variables with files that need installing set(DOCFILES diff --git a/cmake/Modules/RunOnBuildDir.cmake b/cmake/Modules/RunOnBuildDir.cmake new file mode 100644 index 000000000..bf674be19 --- /dev/null +++ b/cmake/Modules/RunOnBuildDir.cmake @@ -0,0 +1,29 @@ +# install a few things so that one can run Subsurface from the build +# directory +add_custom_target(themeLink ALL + COMMAND + rm -f ${CMAKE_BINARY_DIR}/theme && + ln -s ${CMAKE_SOURCE_DIR}/theme ${CMAKE_BINARY_DIR}/theme +) +if(NOT NO_PRINTING) + add_custom_target(printing_templatesLink ALL + COMMAND + rm -f ${CMAKE_BINARY_DIR}/printing_templates && + ln -s ${CMAKE_SOURCE_DIR}/printing_templates ${CMAKE_BINARY_DIR}/printing_templates + ) +endif() +if(NOT NO_DOCS) + add_custom_target( + documentationLink ALL + COMMAND + mkdir -p ${CMAKE_BINARY_DIR}/Documentation/ && + rm -rf ${CMAKE_BINARY_DIR}/Documentation/images && + ln -s ${CMAKE_SOURCE_DIR}/Documentation/images ${CMAKE_BINARY_DIR}/Documentation/images + ) + add_custom_target( + documentation ALL + COMMAND + ${CMAKE_MAKE_PROGRAM} -C ${CMAKE_SOURCE_DIR}/Documentation OUT=${CMAKE_BINARY_DIR}/Documentation/ doc + DEPENDS documentationLink + ) +endif() \ No newline at end of file