diff CMakeLists.txt @ 601:84011417321d

better version handling
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 11 Oct 2013 12:06:55 +0200
parents 851b6a19a81c
children b82292ba2083 ce5d2040c47b
line wrap: on
line diff
--- a/CMakeLists.txt	Thu Oct 10 15:08:01 2013 +0200
+++ b/CMakeLists.txt	Fri Oct 11 12:06:55 2013 +0200
@@ -340,15 +340,20 @@
   endif()
 
 
-  # Set the version of the shared library for releases
-  string(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+$" ORTHANC_IS_RELEASE ${ORTHANC_VERSION})
-  if (ORTHANC_IS_RELEASE)
-    string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\1.\\2" ORTHANC_RELEASE ${ORTHANC_VERSION})
-    message("This is a release build, setting the version of the library to ${ORTHANC_RELEASE}")
-    set_target_properties(OrthancClient PROPERTIES VERSION ${ORTHANC_RELEASE} SOVERSION ${ORTHANC_RELEASE})
-  else()
-    message("This is not a release build")
-  endif()
+  # Set the version of the "Orthanc Client" shared library
+  file(STRINGS
+    ${CMAKE_SOURCE_DIR}/OrthancCppClient/SharedLibrary/Product.json
+    ORTHANC_CLIENT_VERSION_TMP
+    REGEX "^[ \t]*\"Version\"[ \t]*")
+
+  string(REGEX REPLACE "^.*\"([0-9]+)\\.([0-9]+)\\.([0-9]+)\"" "\\1.\\2" 
+    ORTHANC_CLIENT_VERSION ${ORTHANC_CLIENT_VERSION_TMP})
+
+  message("Setting the version of the library to ${ORTHANC_CLIENT_VERSION}")
+
+  set_target_properties(OrthancClient PROPERTIES 
+    VERSION ${ORTHANC_CLIENT_VERSION} 
+    SOVERSION ${ORTHANC_CLIENT_VERSION})
 
 
   install(