cmake: bump version to 3.7.2
[buildroot-gz.git] / package / cmake / cmake.mk
blob0fd71391faa00172c4d64446ec652c8bb32295a2
1 ################################################################################
3 # cmake
5 ################################################################################
7 CMAKE_VERSION_MAJOR = 3.7
8 CMAKE_VERSION = $(CMAKE_VERSION_MAJOR).2
9 CMAKE_SITE = https://cmake.org/files/v$(CMAKE_VERSION_MAJOR)
10 CMAKE_LICENSE = BSD-3c
11 CMAKE_LICENSE_FILES = Copyright.txt
13 # CMake is a particular package:
14 # * CMake can be built using the generic infrastructure or the cmake one.
15 # Since Buildroot has no requirement regarding the host system cmake
16 # program presence, it uses the generic infrastructure to build the
17 # host-cmake package, then the (target-)cmake package can be built
18 # using the cmake infrastructure;
19 # * CMake bundles its dependencies within its sources. This is the
20 # reason why the host-cmake package has no dependencies:, whereas
21 # the (target-)cmake package has a lot of dependencies, using only
22 # the system-wide libraries instead of rebuilding and statically
23 # linking with the ones bundled into the CMake sources.
25 CMAKE_DEPENDENCIES = zlib jsoncpp libcurl libarchive expat bzip2 xz libuv
27 CMAKE_CONF_OPTS = \
28 -DKWSYS_LFS_WORKS=TRUE \
29 -DKWSYS_CHAR_IS_SIGNED=TRUE \
30 -DCMAKE_USE_SYSTEM_LIBRARIES=1 \
31 -DCTEST_USE_XMLRPC=OFF \
32 -DBUILD_CursesDialog=OFF
34 # Get rid of -I* options from $(HOST_CPPFLAGS) to prevent that a
35 # header available in $(HOST_DIR)/usr/include is used instead of a
36 # CMake internal header, e.g. lzma* headers of the xz package
37 HOST_CMAKE_CFLAGS = $(shell echo $(HOST_CFLAGS) | sed -r "s%$(HOST_CPPFLAGS)%%")
38 HOST_CMAKE_CXXFLAGS = $(shell echo $(HOST_CXXFLAGS) | sed -r "s%$(HOST_CPPFLAGS)%%")
40 define HOST_CMAKE_CONFIGURE_CMDS
41 (cd $(@D); \
42 $(HOST_CONFIGURE_OPTS) \
43 CFLAGS="$(HOST_CMAKE_CFLAGS)" \
44 ./bootstrap --prefix=$(HOST_DIR)/usr \
45 --parallel=$(PARALLEL_JOBS) -- \
46 -DCMAKE_C_FLAGS="$(HOST_CMAKE_CFLAGS)" \
47 -DCMAKE_CXX_FLAGS="$(HOST_CMAKE_CXXFLAGS)" \
48 -DCMAKE_EXE_LINKER_FLAGS="$(HOST_LDFLAGS)" \
49 -DBUILD_CursesDialog=OFF \
51 endef
53 define HOST_CMAKE_BUILD_CMDS
54 $(HOST_MAKE_ENV) $(MAKE) -C $(@D)
55 endef
57 define HOST_CMAKE_INSTALL_CMDS
58 $(HOST_MAKE_ENV) $(MAKE) -C $(@D) install/fast
59 endef
61 define CMAKE_REMOVE_EXTRA_DATA
62 rm $(TARGET_DIR)/usr/bin/{cmake,cpack}
63 rm -fr $(TARGET_DIR)/usr/share/cmake-$(CMAKE_VERSION_MAJOR)/{completions,editors}
64 rm -fr $(TARGET_DIR)/usr/share/cmake-$(CMAKE_VERSION_MAJOR)/{Help,include}
65 endef
67 define CMAKE_INSTALL_CTEST_CFG_FILE
68 $(INSTALL) -m 0644 -D $(@D)/Modules/CMake.cmake \
69 $(TARGET_DIR)/usr/share/cmake-$(CMAKE_VERSION_MAJOR)/Modules/CMake.cmake.ctest
70 endef
72 CMAKE_POST_INSTALL_TARGET_HOOKS += CMAKE_REMOVE_EXTRA_DATA
73 CMAKE_POST_INSTALL_TARGET_HOOKS += CMAKE_INSTALL_CTEST_CFG_FILE
75 define CMAKE_INSTALL_TARGET_CMDS
76 (cd $(@D); \
77 $(HOST_MAKE_ENV) DESTDIR=$(TARGET_DIR) \
78 cmake -P cmake_install.cmake \
80 endef
82 $(eval $(cmake-package))
83 $(eval $(host-generic-package))