Update CMakeLists to use add_compile_definitions

This commit is contained in:
Tristan Penman 2022-02-08 09:21:21 +11:00
parent f97013928d
commit c2822576a2

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.1) cmake_minimum_required(VERSION 3.1.2)
project(valijson) project(valijson)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
@ -54,12 +54,12 @@ if(NOT valijson_BUILD_TESTS AND NOT valijson_BUILD_EXAMPLES)
endif() endif()
if(valijson_USE_EXCEPTIONS) if(valijson_USE_EXCEPTIONS)
add_definitions(-DVALIJSON_USE_EXCEPTIONS=1) add_compile_definitions(VALIJSON_USE_EXCEPTIONS=1)
else() else()
add_definitions(-D_HAS_EXCEPTIONS=0) add_compile_definitions(_HAS_EXCEPTIONS=0)
add_definitions(-DBOOST_NO_EXCEPTIONS) add_compile_definitions(BOOST_NO_EXCEPTIONS)
add_definitions(-DJSON_USE_EXCEPTION=0) add_compile_definitions(JSON_USE_EXCEPTION=0)
add_definitions(-DVALIJSON_USE_EXCEPTIONS=0) add_compile_definitions(VALIJSON_USE_EXCEPTIONS=0)
endif() endif()
find_package(Poco OPTIONAL_COMPONENTS JSON) find_package(Poco OPTIONAL_COMPONENTS JSON)
@ -175,7 +175,7 @@ if(valijson_BUILD_TESTS)
set_target_properties(test_suite PROPERTIES COMPILE_DEFINITIONS "PICOJSON_USE_INT64") set_target_properties(test_suite PROPERTIES COMPILE_DEFINITIONS "PICOJSON_USE_INT64")
if(Boost_FOUND) if(Boost_FOUND)
add_definitions(-DBOOST_ALL_DYN_LINK) add_compile_definitions(BOOST_ALL_DYN_LINK)
set(Boost_USE_STATIC_LIBS OFF) set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON) set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF) set(Boost_USE_STATIC_RUNTIME OFF)