Update requires in xmake.lua of README.md.
[liba.git] / cmake / Project.cmake
blobada43b183189397f565682ea4710ce0a54be0e71
1 set(PROJECT_VERSION 0.1.1)
2 set(PROJECT_LICENSE MPL-2.0)
3 set(PROJECT_CONTACT tqfx@tqfx.org)
4 set(PROJECT_DESCRIPTION "An algorithm library based on C/C++ language")
5 set(PROJECT_HOMEPAGE_URL "https://github.com/tqfx/liba.git")
6 string(REGEX MATCH "[^.]+\\.[^.]+\\.[^.]+\\.[^.]+" PROJECT_VERSION_TWEAK "${PROJECT_VERSION}")
7 string(REGEX REPLACE "^[^.]+\\.[^.]+\\.[^.]+\\.([^.]+).*" "\\1" PROJECT_VERSION_TWEAK "${PROJECT_VERSION_TWEAK}")
8 string(REGEX MATCH "[^.]+\\.[^.]+\\.[^.]+" PROJECT_VERSION_PATCH "${PROJECT_VERSION}")
9 string(REGEX REPLACE "^[^.]+\\.[^.]+\\.([^.]+).*" "\\1" PROJECT_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
10 string(REGEX MATCH "[^.]+\\.[^.]+" PROJECT_VERSION_MINOR "${PROJECT_VERSION}")
11 string(REGEX REPLACE "^[^.]+\\.([^.]+).*" "\\1" PROJECT_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
12 string(REGEX MATCH "[^.]+" PROJECT_VERSION_MAJOR "${PROJECT_VERSION}")
13 if(PROJECT_NAME)
14   set(${PROJECT_NAME}_VERSION ${PROJECT_VERSION})
15   set(${PROJECT_NAME}_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
16   set(${PROJECT_NAME}_VERSION_MINOR ${PROJECT_VERSION_MINOR})
17   set(${PROJECT_NAME}_VERSION_PATCH ${PROJECT_VERSION_PATCH})
18   set(${PROJECT_NAME}_VERSION_TWEAK ${PROJECT_VERSION_TWEAK})
19 endif()
20 if(PROJECT_NAME)
21   set(${PROJECT_NAME}_DESCRIPTION ${PROJECT_DESCRIPTION})
22 endif()
23 if(PROJECT_NAME)
24   set(${PROJECT_NAME}_HOMEPAGE_URL ${PROJECT_HOMEPAGE_URL})
25 endif()
26 if(PROJECT_NAME)
27   set(${PROJECT_NAME}_LICENSE ${PROJECT_LICENSE})
28 endif()
29 if(CMAKE_VERSION VERSION_LESS 3.21)
30   if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
31     set(PROJECT_IS_TOP_LEVEL 1)
32   else()
33     set(PROJECT_IS_TOP_LEVEL 0)
34   endif()
35 endif()
36 if(NOT CMAKE_PROJECT_VERSION_TWEAK AND PROJECT_IS_TOP_LEVEL)
37   set(CMAKE_PROJECT_VERSION_TWEAK ${PROJECT_VERSION_TWEAK} CACHE STATIC "Value Computed by CMake" FORCE)
38 endif()
39 if(NOT CMAKE_PROJECT_VERSION_PATCH AND PROJECT_IS_TOP_LEVEL)
40   set(CMAKE_PROJECT_VERSION_PATCH ${PROJECT_VERSION_PATCH} CACHE STATIC "Value Computed by CMake" FORCE)
41 endif()
42 if(NOT CMAKE_PROJECT_VERSION_MINOR AND PROJECT_IS_TOP_LEVEL)
43   set(CMAKE_PROJECT_VERSION_MINOR ${PROJECT_VERSION_MINOR} CACHE STATIC "Value Computed by CMake" FORCE)
44 endif()
45 if(NOT CMAKE_PROJECT_VERSION_MAJOR AND PROJECT_IS_TOP_LEVEL)
46   set(CMAKE_PROJECT_VERSION_MAJOR ${PROJECT_VERSION_MAJOR} CACHE STATIC "Value Computed by CMake" FORCE)
47 endif()
48 if(NOT CMAKE_PROJECT_HOMEPAGE_URL AND PROJECT_IS_TOP_LEVEL)
49   set(CMAKE_PROJECT_HOMEPAGE_URL ${PROJECT_HOMEPAGE_URL} CACHE STATIC "Value Computed by CMake" FORCE)
50 endif()
51 if(NOT CMAKE_PROJECT_DESCRIPTION AND PROJECT_IS_TOP_LEVEL)
52   set(CMAKE_PROJECT_DESCRIPTION ${PROJECT_DESCRIPTION} CACHE STATIC "Value Computed by CMake" FORCE)
53 endif()
54 if(NOT CMAKE_PROJECT_VERSION AND PROJECT_IS_TOP_LEVEL)
55   set(CMAKE_PROJECT_VERSION ${PROJECT_VERSION} CACHE STATIC "Value Computed by CMake" FORCE)
56 endif()
57 set(CPACK_RPM_PACKAGE_LICENSE ${PROJECT_LICENSE})
58 set(CPACK_PACKAGE_CONTACT ${PROJECT_CONTACT})
59 set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})