changeset 3627:b03854e0f796

trying to fix output folders for OS X and windows
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 25 Jan 2020 11:27:23 +0100
parents 02a4eaa76a25
children 70398cc7aa15
files CMakeLists.txt
diffstat 1 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Sat Jan 25 10:52:02 2020 +0100
+++ b/CMakeLists.txt	Sat Jan 25 11:27:23 2020 +0100
@@ -469,7 +469,7 @@
   include(ExternalProject)
 
   set(Flags)
-  
+
   if (CMAKE_TOOLCHAIN_FILE)
     # Take absolute path to the toolchain
     get_filename_component(TMP ${CMAKE_TOOLCHAIN_FILE} REALPATH BASE ${CMAKE_SOURCE_DIR})
@@ -496,6 +496,12 @@
     ${Flags}
     )
 
+  if (DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY)
+    set(Target ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
+  else()
+    set(Target ${CMAKE_CURRENT_BINARY_DIR})
+  endif()
+
   if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
     if (MSVC)
       set(Prefix "")
@@ -504,14 +510,14 @@
     endif()
 
     install(FILES
-      ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${Prefix}ConnectivityChecks.dll
+      ${Target}/${Prefix}ConnectivityChecks.dll
       DESTINATION "lib")
   else()
     list(GET CMAKE_FIND_LIBRARY_PREFIXES 0 Prefix)
     list(GET CMAKE_FIND_LIBRARY_SUFFIXES 0 Suffix)
     install(FILES
-      ${CMAKE_CURRENT_BINARY_DIR}/${Prefix}ConnectivityChecks${Suffix}
-      ${CMAKE_CURRENT_BINARY_DIR}/${Prefix}ConnectivityChecks${Suffix}.${ORTHANC_VERSION}
+      ${Target}/${Prefix}ConnectivityChecks${Suffix}
+      ${Target}/${Prefix}ConnectivityChecks${Suffix}.${ORTHANC_VERSION}
       DESTINATION "share/orthanc/plugins")
   endif()
 endif()