comparison 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
comparison
equal deleted inserted replaced
1466:0cd0f2ad3599 1467:5068de14eef1
211 UnitTestsSources/JpegLosslessTests.cpp 211 UnitTestsSources/JpegLosslessTests.cpp
212 UnitTestsSources/PluginsTests.cpp 212 UnitTestsSources/PluginsTests.cpp
213 ) 213 )
214 214
215 215
216 set(SERVE_FOLDERS_SOURCES
217 Plugins/Samples/ServeFolders/Plugin.cpp
218 )
219
220
216 set(ORTHANC_EMBEDDED_FILES 221 set(ORTHANC_EMBEDDED_FILES
217 PREPARE_DATABASE ${CMAKE_CURRENT_SOURCE_DIR}/OrthancServer/PrepareDatabase.sql 222 PREPARE_DATABASE ${CMAKE_CURRENT_SOURCE_DIR}/OrthancServer/PrepareDatabase.sql
218 UPGRADE_DATABASE_3_TO_4 ${CMAKE_CURRENT_SOURCE_DIR}/OrthancServer/Upgrade3To4.sql 223 UPGRADE_DATABASE_3_TO_4 ${CMAKE_CURRENT_SOURCE_DIR}/OrthancServer/Upgrade3To4.sql
219 UPGRADE_DATABASE_4_TO_5 ${CMAKE_CURRENT_SOURCE_DIR}/OrthancServer/Upgrade4To5.sql 224 UPGRADE_DATABASE_4_TO_5 ${CMAKE_CURRENT_SOURCE_DIR}/OrthancServer/Upgrade4To5.sql
220 CONFIGURATION_SAMPLE ${CMAKE_CURRENT_SOURCE_DIR}/Resources/Configuration.json 225 CONFIGURATION_SAMPLE ${CMAKE_CURRENT_SOURCE_DIR}/Resources/Configuration.json
291 EmbedResources( 296 EmbedResources(
292 ${ORTHANC_EMBEDDED_FILES} 297 ${ORTHANC_EMBEDDED_FILES}
293 ) 298 )
294 endif() 299 endif()
295 300
301 if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
302 execute_process(
303 COMMAND
304 ${PYTHON_EXECUTABLE} ${ORTHANC_ROOT}/Resources/WindowsResources.py
305 ${ORTHANC_VERSION} Orthanc Orthanc.exe "Lightweight, RESTful DICOM server for medical imaging"
306 ERROR_VARIABLE Failure
307 OUTPUT_FILE ${AUTOGENERATED_DIR}/Orthanc.rc
308 )
309
310 if (Failure)
311 message(FATAL_ERROR "Error while computing the version information: ${Failure}")
312 endif()
313
314 execute_process(
315 COMMAND
316 ${PYTHON_EXECUTABLE} ${ORTHANC_ROOT}/Resources/WindowsResources.py
317 ${ORTHANC_VERSION} ServeFolders ServeFolders.dll "Orthanc plugin to serve additional folders"
318 ERROR_VARIABLE Failure
319 OUTPUT_FILE ${AUTOGENERATED_DIR}/ServeFolders.rc
320 )
321
322 if (Failure)
323 message(FATAL_ERROR "Error while computing the version information: ${Failure}")
324 endif()
325
326 list(APPEND ORTHANC_RESOURCES ${AUTOGENERATED_DIR}/Orthanc.rc)
327 list(APPEND SERVE_FOLDERS_SOURCES ${AUTOGENERATED_DIR}/ServeFolders.rc)
328 endif()
329
296 330
297 331
298 ##################################################################### 332 #####################################################################
299 ## Build the core of Orthanc 333 ## Build the core of Orthanc
300 ##################################################################### 334 #####################################################################
357 # Ensure autogenerated code is built before building ServerLibrary 391 # Ensure autogenerated code is built before building ServerLibrary
358 add_dependencies(ServerLibrary CoreLibrary) 392 add_dependencies(ServerLibrary CoreLibrary)
359 393
360 add_executable(Orthanc 394 add_executable(Orthanc
361 OrthancServer/main.cpp 395 OrthancServer/main.cpp
396 ${ORTHANC_RESOURCES}
362 ) 397 )
363 398
364 target_link_libraries(Orthanc ServerLibrary CoreLibrary ${STATIC_LUA} ${STATIC_GOOGLE_LOG} ${DCMTK_LIBRARIES}) 399 target_link_libraries(Orthanc ServerLibrary CoreLibrary ${STATIC_LUA} ${STATIC_GOOGLE_LOG} ${DCMTK_LIBRARIES})
365 400
366 if (${OPENSSL_SOURCES_LENGTH} GREATER 0) 401 if (${OPENSSL_SOURCES_LENGTH} GREATER 0)
406 441
407 include_directories(${CMAKE_SOURCE_DIR}/Plugins/Include) 442 include_directories(${CMAKE_SOURCE_DIR}/Plugins/Include)
408 443
409 add_library( 444 add_library(
410 ServeFolders SHARED 445 ServeFolders SHARED
411 Plugins/Samples/ServeFolders/Plugin.cpp 446 ${SERVE_FOLDERS_SOURCES}
412 ${JSONCPP_SOURCES} 447 ${JSONCPP_SOURCES}
413 ) 448 )
414 449
415 set_target_properties( 450 set_target_properties(
416 ServeFolders PROPERTIES 451 ServeFolders PROPERTIES