CMake/Tests/FindJsonCpp/Test/CMakeLists.txt
Brad King a576844263 FindJsonCpp: Drop new module due to upstream jsoncpp providing package
Since jsoncpp 0.7.0 (2014-11-20) the upstream may provide a CMake
package configuration file such that find_package(jsoncpp) will find a
jsoncppConfig.cmake file.  In order to avoid conflicting with this
(especially on case-insensitive filesystems), and since we always prefer
projects to provide package config files (that they maintain), it is
better to not provide FindJsonCpp publicly.

Move FindJsonCpp into a private source directory that is not installed
so that we can still use it for building CMake itself.

Reported-by: Ryan Pavlik <ryan.pavlik@gmail.com>
2015-02-20 08:22:02 -05:00

18 lines
647 B
CMake

cmake_minimum_required(VERSION 3.1)
project(TestFindJsonCpp CXX)
include(CTest)
# CMake does not actually provide FindJsonCpp publicly.
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../Source/Modules)
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)