summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-12-06 18:44:43 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2017-12-06 18:44:43 +0100
commitf3954e8390b24c32a47bd543c25cdad80b59eb27 (patch)
treeef9cfbe4fc11c3a51892dde238580c1da0c1a93e
parent935c39052d657359414fc395192767f5ac81abb5 (diff)
Doesn't set rpath for built target and update doc
Rpath could be set using a target property if needed in the mean time no rpath is used by default. Change-Id: Ia704b00972545ed73dee98ea88e17d0ef08cf014 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r--cmake/cmake.d/02-variables.cmake12
-rw-r--r--docs/dev_guide/3_advanced_usage.md3
2 files changed, 12 insertions, 3 deletions
diff --git a/cmake/cmake.d/02-variables.cmake b/cmake/cmake.d/02-variables.cmake
index e64b8f1..0fc55a3 100644
--- a/cmake/cmake.d/02-variables.cmake
+++ b/cmake/cmake.d/02-variables.cmake
@@ -79,6 +79,7 @@ execute_process(COMMAND git status --short
if(NOT DEFINED PROJECT_VERSION)
set(PROJECT_VERSION ${GIT_PROJECT_VERSION})
endif()
+
# Release additionnals informations isn't supported so setting project
# attributes then add the dirty flag if git repo not sync'ed
project(${PROJECT_NAME} VERSION ${PROJECT_VERSION} LANGUAGES ${PROJECT_LANGUAGES})
@@ -86,9 +87,6 @@ if(NOT ${DIRTY_FLAG})
set(PROJECT_VERSION "${PROJECT_VERSION}-dirty")
endif()
-#set(PROJECT_LIBDIR "${CMAKE_SOURCE_DIR}/libs" CACHE PATH "Subpath to libraries")
-#set(PROJECT_RESOURCES "${CMAKE_SOURCE_DIR}/data" CACHE PATH "Subpath to data")
-
set(AFB_TOKEN "" CACHE PATH "Default AFB_TOKEN")
set(AFB_REMPORT "1234" CACHE PATH "Default AFB_TOKEN")
@@ -179,3 +177,11 @@ set(ETCDIR etc CACHE PATH "Read only system configuration data")
set(LIBDIR lib CACHE PATH "System library directory")
set(HTTPDIR htdocs CACHE PATH "HTML5 data directory")
set(DATADIR data CACHE PATH "External data resources files")
+
+# Normally CMake uses the build tree for the RPATH when building executables
+# etc on systems that use RPATH. When the software is installed the executables
+# etc are relinked by CMake to have the install RPATH. If this variable is set
+# to true then the software is always built with the install path for the RPATH
+# and does not need to be relinked when installed.
+# Rpath could be set and controlled by target property INSTALL_RPATH
+set(CMAKE_BUILD_WITH_INSTALL_RPATH true)
diff --git a/docs/dev_guide/3_advanced_usage.md b/docs/dev_guide/3_advanced_usage.md
index c08123a..3ea8344 100644
--- a/docs/dev_guide/3_advanced_usage.md
+++ b/docs/dev_guide/3_advanced_usage.md
@@ -68,6 +68,9 @@ SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES
> targets. This is already handle by template and will be installed in the
> following path : **${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}**
+> **NOTE**: if you want to set and use `rpath` with your target you should use
+> and set the target property `INSTALL_RPATH`.
+
## Add external 3rd party library
### Build, link and ship external library with the project