|
26 | 26 | # along with this program; if not, write to the Free Software Foundation, Inc.,
|
27 | 27 | # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
28 | 28 |
|
| 29 | +cmake_minimum_required(VERSION 3.5) |
| 30 | + |
| 31 | +project(MySQL_CONCPP_Packages) |
| 32 | + |
| 33 | +# Note: version.cmake can be already included if this is used as part of |
| 34 | +# the top-level project. |
| 35 | + |
| 36 | +if(NOT DEFINED CONCPP_VERSION) |
| 37 | + include(${CMAKE_CURRENT_SOURCE_DIR}/../version.cmake) |
| 38 | +endif() |
| 39 | + |
| 40 | +include(PackageSpecs.cmake) |
| 41 | + |
| 42 | + |
| 43 | +# ====================================================================== |
| 44 | +# RPM/DEB package specifications |
| 45 | +# ====================================================================== |
| 46 | + |
| 47 | + |
| 48 | +add_subdirectory(deb-in) |
| 49 | + |
| 50 | + |
| 51 | +if(PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME) |
| 52 | + set(rpm_spec "${CMAKE_CURRENT_BINARY_DIR}/SPECS/mysql-connector-c++.spec") |
| 53 | + file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/SOURCES) |
| 54 | +else() |
| 55 | + # Note: Preserve old behavior when included from the main CMakeLists.txt |
| 56 | + set(rpm_spec "${CMAKE_CURRENT_BINARY_DIR}/mysql-connector-c++.spec") |
| 57 | +endif() |
| 58 | + |
| 59 | +configure_file(mysql-connector-c++.spec.in "${rpm_spec}" @ONLY) |
| 60 | + |
| 61 | + |
| 62 | +# |
| 63 | +# If building this project stand-alone we stop here after generating RPM/DEB |
| 64 | +# package specifications. Otherwise the rest of the project contains |
| 65 | +# specifications for building packages using CPack (works with TGZ generator). |
| 66 | +# |
| 67 | + |
| 68 | +if(PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME) |
| 69 | + return() |
| 70 | +endif() |
| 71 | + |
| 72 | + |
29 | 73 | # ======================================================================
|
30 | 74 | # Install manifest
|
31 | 75 | # ======================================================================
|
|
37 | 81 |
|
38 | 82 | if(DEFINED INSTALL_MANIFEST)
|
39 | 83 |
|
40 |
| -add_custom_target(generate_manifest |
41 |
| - ALL |
42 |
| - COMMAND ${CMAKE_COMMAND} |
43 |
| - -D MANIFEST_FILE=${INSTALL_MANIFEST} |
44 |
| - -D BUILD_DIR=${PROJECT_BINARY_DIR} |
45 |
| - -D CONFIG=$<CONFIG> |
46 |
| - -P "${CMAKE_CURRENT_SOURCE_DIR}/install_manifest.cmake" |
47 |
| - WORKING_DIRECTORY ${PROJECT_BINARY_DIR} |
48 |
| - COMMENT "Generating install manifest" |
49 |
| -) |
| 84 | + if(NOT MySQL_CONCPP_BINARY_DIR) |
| 85 | + abort("Top-level binary dir unknown...") |
| 86 | + endif() |
| 87 | + |
| 88 | + add_custom_target(generate_manifest |
| 89 | + ALL |
| 90 | + COMMAND ${CMAKE_COMMAND} |
| 91 | + -D MANIFEST_FILE=${INSTALL_MANIFEST} |
| 92 | + -D BUILD_DIR=${MySQL_CONCPP_BINARY_DIR} |
| 93 | + -D CONFIG=$<CONFIG> |
| 94 | + -P "${CMAKE_CURRENT_SOURCE_DIR}/install_manifest.cmake" |
| 95 | + WORKING_DIRECTORY ${MySQL_CONCPP_BINARY_DIR} |
| 96 | + COMMENT "Generating install manifest" |
| 97 | + ) |
50 | 98 |
|
51 | 99 | endif()
|
52 | 100 |
|
@@ -81,26 +129,22 @@ foreach(file ${info_files})
|
81 | 129 |
|
82 | 130 | endforeach()
|
83 | 131 |
|
84 |
| -set(CPACK_RESOURCE_FILE_README "${CMAKE_BINARY_DIR}/README${info_ext}") |
85 |
| -set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_BINARY_DIR}/${LIC_FILE}${info_ext}") |
86 |
| -#set(CPACK_RESOURCE_FILE_INSTALL "...") # FIXME |
87 |
| - |
88 | 132 |
|
89 | 133 | # ======================================================================
|
90 |
| -# Package specifications |
| 134 | +# Package definitions |
91 | 135 | # ======================================================================
|
92 | 136 |
|
93 | 137 | if(APPLE AND NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
94 | 138 | message(FATAL_ERROR "To create packages for OSX, build with clang compiler.")
|
95 | 139 | endif()
|
96 | 140 |
|
97 | 141 |
|
98 |
| -include(PackageSpecs.cmake) # Note: must be included before CPack |
| 142 | +include(CPack) |
99 | 143 |
|
100 |
| -CONFIGURE_FILE(mysql-connector-c++.spec.in ${CMAKE_CURRENT_BINARY_DIR}/mysql-connector-c++.spec @ONLY) |
101 |
| -ADD_SUBDIRECTORY(deb-in) |
| 144 | +set(CPACK_RESOURCE_FILE_README "${CMAKE_BINARY_DIR}/README${info_ext}") |
| 145 | +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_BINARY_DIR}/${LIC_FILE}${info_ext}") |
| 146 | +#set(CPACK_RESOURCE_FILE_INSTALL "...") # FIXME |
102 | 147 |
|
103 |
| -include(CPack) |
104 | 148 |
|
105 | 149 | # Define install component groups.
|
106 | 150 |
|
|
0 commit comments