changeset 50:697bf85e8e19

CMake: move executables into fakeroot/bin
author David Demelier <markand@malikania.fr>
date Thu, 15 Dec 2016 13:42:13 +0100
parents 2804ae55c70f
children d04a4915be2b
files cmake/MalikaniaOptions.cmake cmake/function/MalikaniaDefineExecutable.cmake
diffstat 2 files changed, 26 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/cmake/MalikaniaOptions.cmake	Fri Dec 09 13:28:45 2016 +0100
+++ b/cmake/MalikaniaOptions.cmake	Thu Dec 15 13:42:13 2016 +0100
@@ -17,6 +17,19 @@
 #
 
 #
+# Fakeroot directory.
+# -------------------------------------------------------------------
+#
+# This option specifies where to build the project as it would be installed
+# using the install target or installers.
+#
+# This helps development.
+#
+
+set(WITH_FAKEROOT_DIR "${CMAKE_BINARY_DIR}/fakeroot"
+    CACHE STRING "Where to build project as it would be installed")
+
+#
 # Backend selection.
 # -------------------------------------------------------------------
 #
--- a/cmake/function/MalikaniaDefineExecutable.cmake	Fri Dec 09 13:28:45 2016 +0100
+++ b/cmake/function/MalikaniaDefineExecutable.cmake	Thu Dec 15 13:42:13 2016 +0100
@@ -51,4 +51,17 @@
     target_link_libraries(${EXE_TARGET} ${EXE_LIBRARIES})
     target_include_directories(${EXE_TARGET} PRIVATE ${EXE_INCLUDES})
     target_compile_definitions(${EXE_TARGET} PRIVATE ${EXE_FLAGS})
+    set_target_properties(
+        ${EXE_TARGET}
+        PROPERTIES
+            RUNTIME_OUTPUT_DIRECTORY ${WITH_FAKEROOT_DIR}/bin
+    )
+    foreach (c ${CMAKE_CONFIGURATION_TYPES})
+        string(TOUPPER ${c} c)
+        set_target_properties(
+            ${EXE_TARGET}
+            PROPERTIES
+                RUNTIME_OUTPUT_DIRECTORY_${c} ${WITH_FAKEROOT_DIR}/bin
+        )
+    endforeach()
 endfunction()