Fix Windows CI (#4897)

* 👷 fix Windows CI

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 👷 fix Windows CI

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 👷 fix Windows CI

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 👷 fix Windows CI

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 👷 fix Windows CI

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 👷 fix Windows CI

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 👷 fix Windows CI

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 👷 fix Windows CI

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 👷 fix Windows CI

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 👷 fix Windows CI

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 👷 fix Windows CI

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 👷 fix Windows CI

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 👷 fix Windows CI

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 👷 fix Windows CI

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

---------

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann
2025-08-28 16:21:01 +02:00
committed by GitHub
parent ec857100a5
commit 4bc4e37f4f
20 changed files with 142 additions and 111 deletions

View File

@@ -70,34 +70,34 @@ jobs:
- name: Test
run: cd build ; ctest -j 10 -C ${{ matrix.build_type }} --output-on-failure
# clang:
# runs-on: windows-2025
# strategy:
# matrix:
# version: [11, 12, 13, 14, 15]
#
# steps:
# - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
# - name: Install Clang
# run: curl -fsSL -o LLVM${{ matrix.version }}.exe https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ matrix.version }}.0.0/LLVM-${{ matrix.version }}.0.0-win64.exe ; 7z x LLVM${{ matrix.version }}.exe -y -o"C:/Program Files/LLVM"
# - name: Run CMake
# run: cmake -S . -B build -DCMAKE_CXX_COMPILER="C:/Program Files/LLVM/bin/clang++.exe" -G"MinGW Makefiles" -DCMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On
# - name: Build
# run: cmake --build build --parallel 10
# - name: Test
# run: cd build ; ctest -j 10 -C Debug --exclude-regex "test-unicode" --output-on-failure
#
# clang-cl-12:
# runs-on: windows-2025
# strategy:
# matrix:
# architecture: [Win32, x64]
#
# steps:
# - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
# - name: Run CMake
# run: cmake -S . -B build -G "Visual Studio 16 2019" -A ${{ matrix.architecture }} -T ClangCL -DJSON_BuildTests=On
# - name: Build
# run: cmake --build build --config Debug --parallel 10
# - name: Test
# run: cd build ; ctest -j 10 -C Debug --exclude-regex "test-unicode" --output-on-failure
clang:
runs-on: windows-2022
strategy:
matrix:
version: [11.0.1, 12.0.1, 13.0.1, 14.0.6, 15.0.7, 16.0.6, 18.1.8, 19.1.7, 20.1.8]
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Install Clang
run: curl -fsSL -o LLVM${{ matrix.version }}.exe https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ matrix.version }}/LLVM-${{ matrix.version }}-win64.exe ; 7z x LLVM${{ matrix.version }}.exe -y -o"C:/Program Files/LLVM"
- name: Run CMake
run: cmake -S . -B build -DCMAKE_CXX_COMPILER="C:/Program Files/LLVM/bin/clang++.exe" -DCMAKE_CXX_FLAGS="--target=x86_64-w64-mingw32 -stdlib=libstdc++ -pthread" -DCMAKE_EXE_LINKER_FLAGS="-lwinpthread" -G"MinGW Makefiles" -DCMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On
- name: Build
run: cmake --build build --parallel 10
- name: Test
run: cd build ; ctest -j 10 -C Debug --exclude-regex "test-unicode" --output-on-failure
clang-cl-12:
runs-on: windows-2022
strategy:
matrix:
architecture: [Win32, x64]
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Run CMake
run: cmake -S . -B build -G "Visual Studio 17 2022" -A ${{ matrix.architecture }} -T ClangCL -DJSON_BuildTests=On
- name: Build
run: cmake --build build --config Debug --parallel 10
- name: Test
run: cd build ; ctest -j 10 -C Debug --exclude-regex "test-unicode" --output-on-failure

View File

@@ -15,82 +15,84 @@ violations will result in a failed build.
??? abstract "Compilers used in continuous integration"
| Compiler | Architecture | Operating System | CI |
|----------------------------------------------|--------------|--------------------------|-----------|
| AppleClang 14.0.0.14000029; Xcode 14.1 | x86_64 | macOS 13.7.2 (Ventura) | GitHub |
| AppleClang 14.0.0.14000029; Xcode 14.2 | x86_64 | macOS 13.7.2 (Ventura) | GitHub |
| AppleClang 14.0.3.14030022; Xcode 14.3.1 | x86_64 | macOS 13.7.2 (Ventura) | GitHub |
| AppleClang 15.0.0.15000040; Xcode 15.0.1 | x86_64 | macOS 13.7.2 (Ventura) | GitHub |
| AppleClang 15.0.0.15000100; Xcode 15.1 | x86_64 | macOS 13.7.2 (Ventura) | GitHub |
| AppleClang 15.0.0.15000100; Xcode 15.2 | x86_64 | macOS 13.7.2 (Ventura) | GitHub |
| AppleClang 15.0.0.15000309; Xcode 15.3 | arm64 | macOS 14.7.2 (Sonoma) | GitHub |
| AppleClang 15.0.0.15000309; Xcode 15.4 | arm64 | macOS 14.7.2 (Sonoma) | GitHub |
| AppleClang 16.0.0.16000026; Xcode 16 | arm64 | macOS 15.2 (Sequoia) | GitHub |
| AppleClang 16.0.0.16000026; Xcode 16.1 | arm64 | macOS 15.2 (Sequoia) | GitHub |
| AppleClang 16.0.0.16000026; Xcode 16.2 | arm64 | macOS 15.2 (Sequoia) | GitHub |
| AppleClang 17.0.0.17000013; Xcode 16.3 | arm64 | macOS 15.5 (Sequoia) | GitHub |
| Clang 3.5.2 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 3.6.2 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 3.7.1 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 3.8.1 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 3.9.1 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 4.0.1 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 5.0.2 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 6.0.1 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 7.1.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 8.0.1 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 9.0.1 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 10.0.1 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 11.0.0 with GNU-like command-line | x86_64 | Windows 10 (Build 17763) | GitHub |
| Clang 11.1.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 12.0.0 with GNU-like command-line | x86_64 | Windows 10 (Build 17763) | GitHub |
| Clang 12.0.0 with MSVC-like command-line | x86_64 | Windows 10 (Build 17763) | GitHub |
| Clang 12.0.1 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 13.0.0 with GNU-like command-line | x86_64 | Windows 10 (Build 17763) | GitHub |
| Clang 13.0.1 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 14.0.0 with GNU-like command-line | x86_64 | Windows 10 (Build 17763) | GitHub |
| Clang 14.0.6 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 15.0.0 with GNU-like command-line | x86_64 | Windows 10 (Build 17763) | GitHub |
| Clang 15.0.7 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 16.0.6 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 17.0.6 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 18.1.8 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 19.1.7 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 20.1.1 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 21.0.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Emscripten 4.0.6 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| GNU 4.8.5 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| GNU 4.9.3 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| GNU 5.5.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| GNU 6.4.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| GNU 7.5.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| GNU 8.5.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| GNU 9.3.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| GNU 9.4.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| GNU 9.5.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| GNU 10.5.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| GNU 11.4.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| GNU 11.5.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| GNU 12.2.0 (MinGW-W64 i686-ucrt-posix-dwarf) | x86_64 | Windows 10 (Build 17763) | GitHub |
| GNU 12.2.0 (MinGW-W64 x86_64-ucrt-posix-seh) | x86_64 | Windows 10 (Build 17763) | GitHub |
| GNU 12.4.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| GNU 13.3.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| GNU 14.2.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| GNU 14.2.0 | arm64 | Linux 6.1.100 | Cirrus CI |
| GNU 15.1.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| icpc (ICC) 2021.5.0 20211109 | x86_64 | Ubuntu 20.04.3 LTS | GitHub |
| MSVC 19.0.24241.7 | x86 | Windows 8.1 | AppVeyor |
| MSVC 19.16.27035.0 | x86 | Windows-10 (Build 14393) | AppVeyor |
| MSVC 19.29.30157.0 | x86 | Windows 10 (Build 17763) | GitHub |
| MSVC 19.29.30157.0 | x86_64 | Windows 10 (Build 17763) | GitHub |
| MSVC 19.29.30157.0 | x86 | Windows-10 (Build 17763) | AppVeyor |
| MSVC 19.42.34435.0 | x86 | Windows 10 (Build 20348) | GitHub |
| MSVC 19.42.34435.0 | x86_64 | Windows 10 (Build 20348) | GitHub |
| Compiler | Architecture | Operating System | CI |
|----------------------------------------------|--------------|-----------------------------------|-----------|
| AppleClang 14.0.0.14000029; Xcode 14.1 | x86_64 | macOS 13.7.2 (Ventura) | GitHub |
| AppleClang 14.0.0.14000029; Xcode 14.2 | x86_64 | macOS 13.7.2 (Ventura) | GitHub |
| AppleClang 14.0.3.14030022; Xcode 14.3.1 | x86_64 | macOS 13.7.2 (Ventura) | GitHub |
| AppleClang 15.0.0.15000040; Xcode 15.0.1 | x86_64 | macOS 13.7.2 (Ventura) | GitHub |
| AppleClang 15.0.0.15000100; Xcode 15.1 | x86_64 | macOS 13.7.2 (Ventura) | GitHub |
| AppleClang 15.0.0.15000100; Xcode 15.2 | x86_64 | macOS 13.7.2 (Ventura) | GitHub |
| AppleClang 15.0.0.15000309; Xcode 15.3 | arm64 | macOS 14.7.2 (Sonoma) | GitHub |
| AppleClang 15.0.0.15000309; Xcode 15.4 | arm64 | macOS 14.7.2 (Sonoma) | GitHub |
| AppleClang 16.0.0.16000026; Xcode 16 | arm64 | macOS 15.2 (Sequoia) | GitHub |
| AppleClang 16.0.0.16000026; Xcode 16.1 | arm64 | macOS 15.2 (Sequoia) | GitHub |
| AppleClang 16.0.0.16000026; Xcode 16.2 | arm64 | macOS 15.2 (Sequoia) | GitHub |
| AppleClang 17.0.0.17000013; Xcode 16.3 | arm64 | macOS 15.5 (Sequoia) | GitHub |
| Clang 3.5.2 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 3.6.2 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 3.7.1 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 3.8.1 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 3.9.1 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 4.0.1 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 5.0.2 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 6.0.1 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 7.1.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 8.0.1 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 9.0.1 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 10.0.1 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 11.0.1 with GNU-like command-line | x86_64 | Windows Server 2022 (Build 20348) | GitHub |
| Clang 11.1.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 12.0.1 with GNU-like command-line | x86_64 | Windows Server 2022 (Build 20348) | GitHub |
| Clang 12.0.1 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 13.0.1 with GNU-like command-line | x86_64 | Windows Server 2022 (Build 20348) | GitHub |
| Clang 13.0.1 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 14.0.6 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 14.0.6 with GNU-like command-line | x86_64 | Windows Server 2022 (Build 20348) | GitHub |
| Clang 15.0.7 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 15.0.7 with GNU-like command-line | x86_64 | Windows Server 2022 (Build 20348) | GitHub |
| Clang 16.0.6 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 16.0.6 with GNU-like command-line | x86_64 | Windows Server 2022 (Build 20348) | GitHub |
| Clang 17.0.6 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 18.1.8 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 18.1.8 with GNU-like command-line | x86_64 | Windows Server 2022 (Build 20348) | GitHub |
| Clang 19.1.5 with MSVC-like command-line | x86_64 | Windows Server 2022 (Build 20348) | GitHub |
| Clang 19.1.7 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 19.1.7 with GNU-like command-line | x86_64 | Windows Server 2022 (Build 20348) | GitHub |
| Clang 20.1.1 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Clang 20.1.8 with GNU-like command-line | x86_64 | Windows Server 2022 (Build 20348) | GitHub |
| Clang 21.0.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| Emscripten 4.0.6 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| GNU 4.8.5 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| GNU 4.9.3 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| GNU 5.5.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| GNU 6.4.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| GNU 7.5.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| GNU 8.5.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| GNU 9.3.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| GNU 9.4.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| GNU 9.5.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| GNU 10.5.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| GNU 11.4.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| GNU 11.5.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| GNU 12.2.0 (MinGW-W64 i686-ucrt-posix-dwarf) | x86_64 | Windows Server 2022 (Build 20348) | GitHub |
| GNU 12.2.0 (MinGW-W64 x86_64-ucrt-posix-seh) | x86_64 | Windows Server 2022 (Build 20348) | GitHub |
| GNU 12.4.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| GNU 13.3.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| GNU 14.2.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| GNU 14.2.0 | arm64 | Linux 6.1.100 | Cirrus CI |
| GNU 15.1.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
| icpc (ICC) 2021.5.0 20211109 | x86_64 | Ubuntu 20.04.3 LTS | GitHub |
| MSVC 19.0.24241.7 | x86 | Windows 8.1 | AppVeyor |
| MSVC 19.16.27035.0 | x86 | Windows-10 (Build 14393) | AppVeyor |
| MSVC 19.29.30157.0 | x86 | Windows-10 (Build 17763) | AppVeyor |
| MSVC 19.44.35214.0 | x86 | Windows Server 2022 (Build 20348) | GitHub |
| MSVC 19.44.35214.0 | x86_64 | Windows Server 2022 (Build 20348) | GitHub |
- [x] The library is compiled with all C++ language revisions (C++11, C++14, C++17, C++20, C++23, and C++26) to detect
and fix language deprecations early.
- [x] The library is checked for compiler warnings:
- On Clang, `-Weverything` is used with 7 exceptions.
- On Clang, `-Weverything` is used with 8 exceptions.
??? abstract "Clang warnings"

View File

@@ -2,6 +2,7 @@ add_test(NAME cmake_add_subdirectory_configure
COMMAND ${CMAKE_COMMAND}
-G "${CMAKE_GENERATOR}"
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-Dnlohmann_json_source=${PROJECT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/project
)

View File

@@ -2,6 +2,10 @@ cmake_minimum_required(VERSION 3.5...3.14)
project(DummyImport CXX)
if(MSVC)
add_compile_options(/EHsc)
endif()
set(JSON_BuildTests OFF CACHE INTERNAL "")
add_subdirectory(${nlohmann_json_source}
${CMAKE_CURRENT_BINARY_DIR}/nlohmann_json)

View File

@@ -8,7 +8,7 @@
#include <nlohmann/json.hpp>
int main(int argc, char** argv)
int main()
{
nlohmann::json j;

View File

@@ -3,6 +3,7 @@ if (${CMAKE_VERSION} VERSION_GREATER "3.11.0")
COMMAND ${CMAKE_COMMAND}
-G "${CMAKE_GENERATOR}"
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-Dnlohmann_json_source=${PROJECT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/project
)

View File

@@ -13,6 +13,10 @@ if(NOT json_POPULATED)
add_subdirectory(${json_SOURCE_DIR} ${json_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()
if(MSVC)
add_compile_options(/EHsc)
endif()
add_executable(with_namespace_target main.cpp)
target_link_libraries(with_namespace_target nlohmann_json::nlohmann_json)

View File

@@ -8,7 +8,7 @@
#include <nlohmann/json.hpp>
int main(int argc, char** argv)
int main()
{
nlohmann::json j;

View File

@@ -3,6 +3,7 @@ if (${CMAKE_VERSION} VERSION_GREATER "3.14.0")
COMMAND ${CMAKE_COMMAND}
-G "${CMAKE_GENERATOR}"
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-Dnlohmann_json_source=${PROJECT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/project
)

View File

@@ -8,6 +8,10 @@ get_filename_component(GIT_REPOSITORY_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../.
FetchContent_Declare(json GIT_REPOSITORY ${GIT_REPOSITORY_DIRECTORY} GIT_TAG HEAD)
FetchContent_MakeAvailable(json)
if(MSVC)
add_compile_options(/EHsc)
endif()
add_executable(with_namespace_target main.cpp)
target_link_libraries(with_namespace_target nlohmann_json::nlohmann_json)

View File

@@ -8,7 +8,7 @@
#include <nlohmann/json.hpp>
int main(int argc, char** argv)
int main()
{
nlohmann::json j;

View File

@@ -3,6 +3,7 @@ add_test(NAME cmake_import_configure
-G "${CMAKE_GENERATOR}"
-A "${CMAKE_GENERATOR_PLATFORM}"
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-Dnlohmann_json_DIR=${PROJECT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/project
)

View File

@@ -4,9 +4,12 @@ project(DummyImport CXX)
find_package(nlohmann_json REQUIRED)
if(MSVC)
add_compile_options(/EHsc)
endif()
add_executable(with_namespace_target main.cpp)
target_link_libraries(with_namespace_target nlohmann_json::nlohmann_json)
add_executable(without_namespace_target main.cpp)
target_link_libraries(without_namespace_target nlohmann_json)

View File

@@ -8,7 +8,7 @@
#include <nlohmann/json.hpp>
int main(int argc, char** argv)
int main()
{
nlohmann::json j;

View File

@@ -3,6 +3,7 @@ add_test(NAME cmake_import_minver_configure
-G "${CMAKE_GENERATOR}"
-A "${CMAKE_GENERATOR_PLATFORM}"
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-Dnlohmann_json_DIR=${PROJECT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/project
)

View File

@@ -4,5 +4,9 @@ project(DummyImportMinVer CXX)
find_package(nlohmann_json 3.2.0 REQUIRED)
if(MSVC)
add_compile_options(/EHsc)
endif()
add_executable(with_namespace_target main.cpp)
target_link_libraries(with_namespace_target nlohmann_json::nlohmann_json)

View File

@@ -8,7 +8,7 @@
#include <nlohmann/json.hpp>
int main(int argc, char** argv)
int main()
{
nlohmann::json j;

View File

@@ -2,6 +2,7 @@ add_test(NAME cmake_target_include_directories_configure
COMMAND ${CMAKE_COMMAND}
-G "${CMAKE_GENERATOR}"
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-Dnlohmann_json_source=${PROJECT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/project
)

View File

@@ -2,12 +2,16 @@ cmake_minimum_required(VERSION 3.5...3.14)
project(DummyImport CXX)
if(MSVC)
add_compile_options(/EHsc)
endif()
add_executable(with_private_target main.cpp)
target_include_directories(with_private_target PRIVATE ${nlohmann_json_source}/include)
set_target_properties(with_private_target PROPERTIES CXX_STANDARD 11)
add_executable(with_private_system_target main.cpp)
target_include_directories(with_private_system_target PRIVATE SYSTEM ${nlohmann_json_source}/include)
target_include_directories(with_private_system_target SYSTEM PRIVATE ${nlohmann_json_source}/include)
set_target_properties(with_private_system_target PROPERTIES CXX_STANDARD 11)
# regression from https://github.com/nlohmann/json/discussions/2281

View File

@@ -8,7 +8,7 @@
#include <nlohmann/json.hpp>
int main(int argc, char** argv)
int main()
{
nlohmann::json j;