Преглед изворни кода

ENH: Added variable CTK_MAJOR_VERSION, CTK_MINOR_VERSION and CTK_BUILD_VERSION to CMakeLists.txt

Also set the variable CTK_LIBRARY_PROPERTIES and update the macro ctkMacroBuildQtLib to set the target properties accordingly.
Jean-Christophe Fillion-Robin пре 15 година
родитељ
комит
2b118bff49
2 измењених фајлова са 25 додато и 0 уклоњено
  1. 6 0
      CMake/ctkMacroBuildQtLib.cmake
  2. 19 0
      CMakeLists.txt

+ 6 - 0
CMake/ctkMacroBuildQtLib.cmake

@@ -75,6 +75,12 @@ MACRO(CtkMacroBuildQtLib)
 
   # Set labels associated with the target.
   SET_TARGET_PROPERTIES(${lib_name} PROPERTIES LABELS ${lib_name})
+
+  # Apply user-defined properties to the library target.
+  IF(CTK_LIBRARY_PROPERTIES AND MY_LIBRARY_TYPE STREQUAL "SHARED")
+    SET_TARGET_PROPERTIES(${lib_name} PROPERTIES ${CTK_LIBRARY_PROPERTIES})
+  ENDIF()
+
   # Install rules
   IF(CTK_BUILD_SHARED_LIBS)
     INSTALL(TARGETS ${lib_name}

+ 19 - 0
CMakeLists.txt

@@ -33,6 +33,25 @@ SET(CTK_INSTALL_INCLUDE_DIR "include")
 SET(CTK_INSTALL_DOC_DIR "doc")
 
 #-----------------------------------------------------------------------------
+# CTK version number.  An even minor number corresponds to releases.
+#
+SET(CTK_MAJOR_VERSION 0)
+SET(CTK_MINOR_VERSION 1)
+SET(CTK_BUILD_VERSION 0)
+SET(CTK_VERSION
+    "${CTK_MAJOR_VERSION}.${CTK_MINOR_VERSION}.${CTK_BUILD_VERSION}")
+
+# Append the library version information to the library target
+# properties.  A parent project may set its own properties and/or may
+# block this.
+IF(NOT CTK_NO_LIBRARY_VERSION)
+  SET(CTK_LIBRARY_PROPERTIES ${CTK_LIBRARY_PROPERTIES}
+    VERSION "${CTK_VERSION}"
+    SOVERSION "${CTK_MAJOR_VERSION}.${CTK_MINOR_VERSION}"
+    )
+ENDIF()
+
+#-----------------------------------------------------------------------------
 # Update CMake module path
 # Note: FindXXX.cmake script specific to utility should be copied into Utilities/CMake
 #