mirror of
https://github.com/nlohmann/json.git
synced 2026-10-03 13:10:33 +00:00
The six tests/cmake_* integration-test wrappers had drifted:
- Only cmake_import and cmake_import_minver forwarded
-A "${CMAKE_GENERATOR_PLATFORM}" to the inner configure, and none
forwarded -T "${CMAKE_GENERATOR_TOOLSET}". The Windows workflow
configures the outer build with -A Win32 -T ClangCL, so without
forwarding, the inner projects of cmake_add_subdirectory,
cmake_fetch_content, cmake_fetch_content2 and
cmake_target_include_directories built with the generator defaults
instead of matching the outer build's platform and toolset. Forward
both consistently from all six wrappers.
- cmake_fetch_content and cmake_fetch_content2 passed
-Dnlohmann_json_source to their inner projects, which never read it
(CMake warns "manually-specified variables were not used"); the
inner projects fetch their own copy of the library instead. Drop it.
- tests/CMakeLists.txt set JSON_FORCED_GLOBAL_COMPILE_OPTIONS from the
matching environment variable but never read the cache variable
again; the lines right below it read $ENV{JSON_FORCED_GLOBAL_COMPILE_OPTIONS}
directly, like the LINK_OPTIONS counterpart already does. Remove the
dead set().
This changes which platform and toolset the Win32 and ClangCL CI jobs
build the four newly-forwarding wrappers' inner projects with, which
may surface new failures there; CI has to confirm those jobs.
Verified locally with Ninja (empty -A ""/-T "" is accepted): all 12
cmake_* tests still pass, and the inner fetch_content configures no
longer warn about the unused variable.
Closes #5714 item 6.
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
21 lines
664 B
CMake
21 lines
664 B
CMake
add_test(NAME cmake_fetch_content_configure
|
|
COMMAND ${CMAKE_COMMAND}
|
|
-G "${CMAKE_GENERATOR}"
|
|
-A "${CMAKE_GENERATOR_PLATFORM}"
|
|
-T "${CMAKE_GENERATOR_TOOLSET}"
|
|
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
|
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
|
|
${CMAKE_CURRENT_SOURCE_DIR}/project
|
|
)
|
|
add_test(NAME cmake_fetch_content_build
|
|
COMMAND ${CMAKE_COMMAND} --build .
|
|
)
|
|
set_tests_properties(cmake_fetch_content_configure PROPERTIES
|
|
FIXTURES_SETUP cmake_fetch_content
|
|
LABELS "git_required;not_reproducible"
|
|
)
|
|
set_tests_properties(cmake_fetch_content_build PROPERTIES
|
|
FIXTURES_REQUIRED cmake_fetch_content
|
|
LABELS "git_required;not_reproducible"
|
|
)
|