diff CMakeLists.txt @ 1467:5068de14eef1

Inject version information into Windows binaries
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 30 Jul 2015 09:46:28 +0200
parents ee59f539e222
children 0bde293d7ba0
line wrap: on
line diff
--- a/CMakeLists.txt	Tue Jul 28 09:11:37 2015 +0200
+++ b/CMakeLists.txt	Thu Jul 30 09:46:28 2015 +0200
@@ -213,6 +213,11 @@
   )
 
 
+set(SERVE_FOLDERS_SOURCES
+  Plugins/Samples/ServeFolders/Plugin.cpp
+  )
+
+
 set(ORTHANC_EMBEDDED_FILES
   PREPARE_DATABASE            ${CMAKE_CURRENT_SOURCE_DIR}/OrthancServer/PrepareDatabase.sql
   UPGRADE_DATABASE_3_TO_4     ${CMAKE_CURRENT_SOURCE_DIR}/OrthancServer/Upgrade3To4.sql
@@ -293,6 +298,35 @@
     )
 endif()
 
+if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+  execute_process(
+    COMMAND 
+    ${PYTHON_EXECUTABLE} ${ORTHANC_ROOT}/Resources/WindowsResources.py
+    ${ORTHANC_VERSION} Orthanc Orthanc.exe "Lightweight, RESTful DICOM server for medical imaging"
+    ERROR_VARIABLE Failure
+    OUTPUT_FILE ${AUTOGENERATED_DIR}/Orthanc.rc
+    )
+
+  if (Failure)
+    message(FATAL_ERROR "Error while computing the version information: ${Failure}")
+  endif()
+
+  execute_process(
+    COMMAND 
+    ${PYTHON_EXECUTABLE} ${ORTHANC_ROOT}/Resources/WindowsResources.py
+    ${ORTHANC_VERSION} ServeFolders ServeFolders.dll "Orthanc plugin to serve additional folders"
+    ERROR_VARIABLE Failure
+    OUTPUT_FILE ${AUTOGENERATED_DIR}/ServeFolders.rc
+    )
+
+  if (Failure)
+    message(FATAL_ERROR "Error while computing the version information: ${Failure}")
+  endif()
+
+  list(APPEND ORTHANC_RESOURCES ${AUTOGENERATED_DIR}/Orthanc.rc)
+  list(APPEND SERVE_FOLDERS_SOURCES ${AUTOGENERATED_DIR}/ServeFolders.rc)
+endif()
+
 
 
 #####################################################################
@@ -359,6 +393,7 @@
 
 add_executable(Orthanc
   OrthancServer/main.cpp
+  ${ORTHANC_RESOURCES}
   )
 
 target_link_libraries(Orthanc ServerLibrary CoreLibrary ${STATIC_LUA} ${STATIC_GOOGLE_LOG} ${DCMTK_LIBRARIES})
@@ -408,7 +443,7 @@
 
 add_library(
   ServeFolders SHARED 
-  Plugins/Samples/ServeFolders/Plugin.cpp
+  ${SERVE_FOLDERS_SOURCES}
   ${JSONCPP_SOURCES}
   )