Changeset View
Changeset View
Standalone View
Standalone View
tests/ECMGenerateExportHeaderTest/CMakeLists.txt
- This file was added.
1 | set(installation_path "${CMAKE_CURRENT_BINARY_DIR}/installation/") | ||||
---|---|---|---|---|---|
2 | | ||||
3 | macro(add_generate_export_header_library_test _exclude_deprecated_before_and_at) | ||||
4 | add_test(NAME ecm_generate_export_header-build-library-${_exclude_deprecated_before_and_at} | ||||
5 | COMMAND ${CMAKE_CTEST_COMMAND} | ||||
6 | --build-and-test | ||||
7 | "${CMAKE_CURRENT_SOURCE_DIR}/library" | ||||
8 | "${CMAKE_CURRENT_BINARY_DIR}/library-${_exclude_deprecated_before_and_at}" | ||||
9 | --build-two-config | ||||
10 | --build-generator "${CMAKE_GENERATOR}" | ||||
11 | --build-makeprogram ${CMAKE_MAKE_PROGRAM} | ||||
12 | --build-project library | ||||
13 | --build-target install | ||||
14 | --build-options | ||||
15 | "-DEXCLUDE_DEPRECATED_BEFORE_AND_AT=${_exclude_deprecated_before_and_at}" | ||||
16 | "-DCMAKE_INSTALL_PREFIX:PATH=${installation_path}/library-${_exclude_deprecated_before_and_at}" | ||||
17 | --test-command dummy | ||||
18 | ) | ||||
19 | endmacro() | ||||
20 | | ||||
21 | # test generating the library with different EXCLUDE_DEPRECATED_BEFORE_AND_AT values | ||||
22 | # als install the generated libraries together incl. exported cmake targets, for use in tests below | ||||
23 | # TODO: wariant with DEPRECATED_BASE_VERSION | ||||
24 | add_generate_export_header_library_test(0) | ||||
25 | add_generate_export_header_library_test(2.0.0) | ||||
26 | add_generate_export_header_library_test(CURRENT) | ||||
27 | | ||||
28 | | ||||
29 | macro(add_generate_export_header_consumer_test _disable_deprecated_before_and_at _exclude_deprecated_before_and_at) | ||||
30 | set(_consumer_build "consumer-${_disable_deprecated_before_and_at}-${_exclude_deprecated_before_and_at}") | ||||
31 | add_test(NAME ecm_generate_export_header-${_consumer_build} | ||||
32 | COMMAND ${CMAKE_CTEST_COMMAND} | ||||
33 | --build-and-test | ||||
34 | "${CMAKE_CURRENT_SOURCE_DIR}/consumer" | ||||
35 | "${CMAKE_CURRENT_BINARY_DIR}/${_consumer_build}" | ||||
36 | --build-two-config | ||||
37 | --build-generator "${CMAKE_GENERATOR}" | ||||
38 | --build-makeprogram ${CMAKE_MAKE_PROGRAM} | ||||
39 | --build-project consumer | ||||
40 | --build-options | ||||
41 | "-DDEPRECATED_EXCLUDED_BEFORE_AND_AT:STRING=${_exclude_deprecated_before_and_at}" | ||||
42 | "-DLIBRARY:STRING=library-${_exclude_deprecated_before_and_at}" | ||||
43 | "-DLIBRARY_DISABLE_DEPRECATED_BEFORE_AND_AT:STRING=${_disable_deprecated_before_and_at}" | ||||
44 | --test-command dummy | ||||
45 | ) | ||||
46 | endmacro() | ||||
47 | | ||||
48 | # test using the library, built with different EXCLUDE_DEPRECATED_BEFORE_AND_AT values, | ||||
49 | # while using different DISABLE_DEPRECATED_BEFORE_AND_AT values | ||||
50 | # TODO: test group macros, NO_DEPRECATED, DEPRECATED_WARNINGS_SINCE | ||||
51 | set(library_versions 0 2.0.0 CURRENT) | ||||
52 | list(LENGTH library_versions library_versions_count) | ||||
53 | math(EXPR _last_index ${library_versions_count}-1) | ||||
54 | foreach(_exclude_index RANGE ${_last_index}) | ||||
55 | list(GET library_versions ${_exclude_index} _exclude_deprecated_before_and_at) | ||||
56 | # using disabled API limit below the excluded API limit is not supported and | ||||
57 | # catched by the code generated from the ecm_generate_export_header, | ||||
58 | # so testing those combination will not work, so start from the excluded API limit | ||||
59 | foreach(_disable_index RANGE ${_exclude_index} ${_last_index}) | ||||
60 | list(GET library_versions ${_disable_index} _disable_deprecated_before_and_at) | ||||
61 | add_generate_export_header_consumer_test(${_disable_deprecated_before_and_at} ${_exclude_deprecated_before_and_at}) | ||||
62 | endforeach() | ||||
63 | endforeach() |