meson: use get_variable() update to meson 0.51
[mesa-waffle.git] / third_party / cmocka / CMakeLists.txt
blob70a8ad14f268df4cf82f1b98578fed1a1c2a1d8b
1 project(cmocka C)
3 # Required cmake version
4 cmake_minimum_required(VERSION 2.6.0)
6 # global needed variables
7 set(APPLICATION_NAME ${PROJECT_NAME})
9 set(APPLICATION_VERSION_MAJOR "1")
10 set(APPLICATION_VERSION_MINOR "0")
11 set(APPLICATION_VERSION_PATCH "1")
13 set(APPLICATION_VERSION "${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH}")
15 # SOVERSION scheme: CURRENT.AGE.REVISION
16 #   If there was an incompatible interface change:
17 #     Increment CURRENT. Set AGE and REVISION to 0
18 #   If there was a compatible interface change:
19 #     Increment AGE. Set REVISION to 0
20 #   If the source code was changed, but there were no interface changes:
21 #     Increment REVISION.
22 set(LIBRARY_VERSION "0.3.1")
23 set(LIBRARY_SOVERSION "0")
25 # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
26 set(CMAKE_MODULE_PATH
27   ${CMAKE_SOURCE_DIR}/cmake/Modules
30 # add definitions
31 include(DefineCMakeDefaults)
32 include(DefinePlatformDefaults)
33 include(DefineCompilerFlags)
34 include(DefineInstallationPaths)
35 include(DefineOptions.cmake)
36 include(CPackConfig.cmake)
38 # disallow in-source build
39 include(MacroEnsureOutOfSourceBuild)
40 macro_ensure_out_of_source_build("${PROJECT_NAME} requires an out of source build. Please create a separate build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there.")
42 # config.h checks
43 include(ConfigureChecks.cmake)
44 configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
46 # check subdirectories
47 add_subdirectory(doc)
48 add_subdirectory(include)
49 add_subdirectory(src)
51 if (UNIT_TESTING)
52     include(AddCMockaTest)
53     add_subdirectory(tests)
54 endif (UNIT_TESTING)
56 add_subdirectory(example)
58 # pkg-config file
59 configure_file(cmocka.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/cmocka.pc)
60 install(
61   FILES
62     ${CMAKE_CURRENT_BINARY_DIR}/cmocka.pc
63   DESTINATION
64     ${LIB_INSTALL_DIR}/pkgconfig
65   COMPONENT
66     pkgconfig
69 # cmake config files
70 set(CMOCKA_LIBRARY_NAME ${CMAKE_SHARED_LIBRARY_PREFIX}${PROJECT_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
72 configure_file(${PROJECT_NAME}-config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake @ONLY)
73 configure_file(${PROJECT_NAME}-config-version.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake @ONLY)
74 install(
75     FILES
76         ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake
77         ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake
78     DESTINATION
79         ${CMAKE_INSTALL_DIR}/${PROJECT_NAME}
80     COMPONENT
81         devel