changeset 60:c6d410648367

CMake: use fakeroot/bin for DLL
author David Demelier <markand@malikania.fr>
date Fri, 16 Dec 2016 15:31:44 +0100
parents d639250fd2a3
children e7bf0728eff2
files cmake/function/MalikaniaDefineLibrary.cmake
diffstat 1 files changed, 19 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/cmake/function/MalikaniaDefineLibrary.cmake	Fri Dec 16 15:05:53 2016 +0100
+++ b/cmake/function/MalikaniaDefineLibrary.cmake	Fri Dec 16 15:31:44 2016 +0100
@@ -58,7 +58,6 @@
 
     # Create the shared library.
     add_library(${LIB_TARGET} SHARED ${LIB_SOURCES} ${assets})
-    set_target_properties(${LIB_TARGET} PROPERTIES PREFIX "")
     target_link_libraries(${LIB_TARGET} ${LIB_LIBRARIES})
     target_include_directories(
         ${LIB_TARGET}
@@ -71,5 +70,24 @@
     )
     target_compile_definitions(${LIB_TARGET} PRIVATE ${LIB_FLAGS})
 
+    #
+    # Move the library into fakeroot/bin/ directory for Windows and other
+    # DLL platforms so executables can be ran directly.
+    #
+    set_target_properties(
+        ${LIB_TARGET}
+        PROPERTIES
+            PREFIX ""
+            RUNTIME_OUTPUT_DIRECTORY ${WITH_FAKEROOT_DIR}/bin
+    )
+    foreach (cfg ${CMAKE_CONFIGURATION_TYPES})
+        string(TOUPPER ${cfg} cfg)
+        set_target_properties(
+            ${LIB_TARGET}
+            PROPERTIES
+                RUNTIME_OUTPUT_DIRECTORY_${cfg} ${WITH_FAKEROOT_DIR}/bin
+        )
+    endforeach ()
+
     malikania_vera_check(${LIB_TARGET} ${LIB_SOURCES})
 endfunction()