summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-20 06:06:32 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-20 06:06:32 -0700
commit0726d4c679b1459c8e02b3eda55b77c71e82b5c1 (patch)
treed38a066818461ff393141935cf1dd644287347da
parent8ab7b5ea7f9f5c9f7211a8dbcfcaa2cfd2ee4a09 (diff)
downloadsubsurface-0726d4c679b1459c8e02b3eda55b77c71e82b5c1.tar.gz
Cmake support: fix in tree builds
And add a message that we suggest that out of tree builds are a better idea. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--CMakeLists.txt32
1 files changed, 27 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d7c179281..e562bd872 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -121,6 +121,11 @@ set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} ${LIBDIVECOMPUTER_LIB
# handle out of tree build correctly
string(COMPARE EQUAL "${${PROJECT_NAME}_SOURCE_DIR}" "${${PROJECT_NAME}_BINARY_DIR}" insource)
+if (insource)
+ message(STATUS "building in Subsurface source tree - we recommend out of tree builds")
+else()
+ message(STATUE "out of source build from source in ${${PROJECT_NAME}_SOURCE_DIR}")
+endif()
get_filename_component(PARENTDIR ${${PROJECT_NAME}_SOURCE_DIR} PATH)
string(COMPARE EQUAL "${${PROJECT_NAME}_SOURCE_DIR}" "${PARENTDIR}" insourcesubdir)
if(NOT (insource OR insourcedir))
@@ -467,15 +472,32 @@ endif()
# install a few things so that one can run Subsurface from the build
# directory
-add_custom_target(createLinks 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_templates ALL COMMAND rm -f ${CMAKE_BINARY_DIR}/printing_templates && ln -s ${CMAKE_SOURCE_DIR}/printing_templates ${CMAKE_BINARY_DIR}/printing_templates)
+if(NOT insource)
+ 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 -f ${CMAKE_BINARY_DIR}/Documentation/images &&
+ ln -s ${CMAKE_SOURCE_DIR}/Documentation/images ${CMAKE_BINARY_DIR}/Documentation/images
+ )
+ endif()
endif()
if(NOT NO_DOCS)
add_custom_target(
documentation ALL
- mkdir -p ${CMAKE_BINARY_DIR}/Documentation/ \\;
- cp -a ${CMAKE_SOURCE_DIR}/Documentation/images ${CMAKE_BINARY_DIR}/Documentation/ \\;
make -C ${CMAKE_SOURCE_DIR}/Documentation OUT=${CMAKE_BINARY_DIR}/Documentation/ doc
)
endif()