cmake: add import config tests
This commit is contained in:
parent
1729db85c1
commit
564506a885
10 changed files with 109 additions and 0 deletions
15
test/cmake_import/CMakeLists.txt
Normal file
15
test/cmake_import/CMakeLists.txt
Normal file
|
@ -0,0 +1,15 @@
|
|||
add_test(NAME cmake_import_configure
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-G "${CMAKE_GENERATOR}"
|
||||
-Dnlohmann_json_DIR=${PROJECT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/project
|
||||
)
|
||||
add_test(NAME cmake_import_build
|
||||
COMMAND ${CMAKE_COMMAND} --build .
|
||||
)
|
||||
set_tests_properties(cmake_import_configure PROPERTIES
|
||||
FIXTURES_SETUP cmake_import
|
||||
)
|
||||
set_tests_properties(cmake_import_build PROPERTIES
|
||||
FIXTURES_REQUIRED cmake_import
|
||||
)
|
12
test/cmake_import/project/CMakeLists.txt
Normal file
12
test/cmake_import/project/CMakeLists.txt
Normal file
|
@ -0,0 +1,12 @@
|
|||
cmake_minimum_required(VERSION 3.8)
|
||||
|
||||
project(DummyImport CXX)
|
||||
|
||||
find_package(nlohmann_json REQUIRED)
|
||||
|
||||
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)
|
||||
|
8
test/cmake_import/project/main.cpp
Normal file
8
test/cmake_import/project/main.cpp
Normal file
|
@ -0,0 +1,8 @@
|
|||
#include <nlohmann/json.hpp>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
nlohmann::json j;
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue