summaryrefslogtreecommitdiffstats
path: root/Tests/FindJsonCpp
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-01-16 19:11:38 (GMT)
committerBrad King <brad.king@kitware.com>2015-01-19 14:34:03 (GMT)
commit0aebeb9c84086b19c56a3ced5c95c60063ab37e2 (patch)
treea4db2166cabd84853f9c7487c0fe875f59316b38 /Tests/FindJsonCpp
parent287070ceb8eda82cf58595c9ea2dde57b0d6d45e (diff)
downloadCMake-0aebeb9c84086b19c56a3ced5c95c60063ab37e2.zip
CMake-0aebeb9c84086b19c56a3ced5c95c60063ab37e2.tar.gz
CMake-0aebeb9c84086b19c56a3ced5c95c60063ab37e2.tar.bz2
FindJsonCpp: Add module to find JsonCpp package
Diffstat (limited to 'Tests/FindJsonCpp')
-rw-r--r--Tests/FindJsonCpp/CMakeLists.txt10
-rw-r--r--Tests/FindJsonCpp/Test/CMakeLists.txt14
-rw-r--r--Tests/FindJsonCpp/Test/main.cxx8
3 files changed, 32 insertions, 0 deletions
diff --git a/Tests/FindJsonCpp/CMakeLists.txt b/Tests/FindJsonCpp/CMakeLists.txt
new file mode 100644
index 0000000..9a1fa38
--- /dev/null
+++ b/Tests/FindJsonCpp/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_test(NAME FindJsonCpp.Test COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindJsonCpp/Test"
+ "${CMake_BINARY_DIR}/Tests/FindJsonCpp/Test"
+ ${build_generator_args}
+ --build-project TestFindJsonCpp
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
diff --git a/Tests/FindJsonCpp/Test/CMakeLists.txt b/Tests/FindJsonCpp/Test/CMakeLists.txt
new file mode 100644
index 0000000..4e1e271
--- /dev/null
+++ b/Tests/FindJsonCpp/Test/CMakeLists.txt
@@ -0,0 +1,14 @@
+cmake_minimum_required(VERSION 3.1)
+project(TestFindJsonCpp CXX)
+include(CTest)
+
+find_package(JsonCpp REQUIRED)
+
+add_executable(test_jsoncpp_tgt main.cxx)
+target_link_libraries(test_jsoncpp_tgt JsonCpp::JsonCpp)
+add_test(NAME test_jsoncpp_tgt COMMAND test_jsoncpp_tgt)
+
+add_executable(test_jsoncpp_var main.cxx)
+target_include_directories(test_jsoncpp_var PRIVATE ${JsonCpp_INCLUDE_DIRS})
+target_link_libraries(test_jsoncpp_var PRIVATE ${JsonCpp_LIBRARIES})
+add_test(NAME test_jsoncpp_var COMMAND test_jsoncpp_var)
diff --git a/Tests/FindJsonCpp/Test/main.cxx b/Tests/FindJsonCpp/Test/main.cxx
new file mode 100644
index 0000000..0fefe32
--- /dev/null
+++ b/Tests/FindJsonCpp/Test/main.cxx
@@ -0,0 +1,8 @@
+#include <json/json.h>
+
+int main()
+{
+ int zero = 0;
+ Json::Value value(zero);
+ return value.asInt();
+}