mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2024-12-12 18:10:27 +01:00
Use ccache right (#1139)
* Prevent cmakelint warnings Use 4 spaces for indent, no tabs * Use ccache right fix indents too at CMakeLists.txt
This commit is contained in:
parent
edf528edfa
commit
a6fe8e27d8
@ -38,7 +38,7 @@ foreach(pold "") # Currently Empty
|
|||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# ==== Define language standard configurations requiring at least c++11 standard
|
# ==== Define language standard configurations requiring at least c++11 standard
|
||||||
if(CMAKE_CXX_STANDARD EQUAL "98" )
|
if(CMAKE_CXX_STANDARD EQUAL "98")
|
||||||
message(FATAL_ERROR "CMAKE_CXX_STANDARD:STRING=98 is not supported.")
|
message(FATAL_ERROR "CMAKE_CXX_STANDARD:STRING=98 is not supported.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -62,19 +62,29 @@ if(NOT DEFINED CMAKE_BUILD_TYPE)
|
|||||||
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel Coverage.")
|
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel Coverage.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# use ccache if found, has to be done before project()
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
find_program(CCACHE_EXECUTABLE "ccache" HINTS /usr/local/bin /opt/local/bin)
|
||||||
|
if(CCACHE_EXECUTABLE)
|
||||||
|
message(STATUS "use ccache")
|
||||||
|
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_EXECUTABLE}" CACHE PATH "ccache" FORCE)
|
||||||
|
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_EXECUTABLE}" CACHE PATH "ccache" FORCE)
|
||||||
|
endif()
|
||||||
|
|
||||||
project(JSONCPP
|
project(JSONCPP
|
||||||
# Note: version must be updated in three places when doing a release. This
|
# Note: version must be updated in three places when doing a release. This
|
||||||
# annoying process ensures that amalgamate, CMake, and meson all report the
|
# annoying process ensures that amalgamate, CMake, and meson all report the
|
||||||
# correct version.
|
# correct version.
|
||||||
# 1. /meson.build
|
# 1. ./meson.build
|
||||||
# 2. /include/json/version.h
|
# 2. ./include/json/version.h
|
||||||
# 3. /CMakeLists.txt
|
# 3. ./CMakeLists.txt
|
||||||
# IMPORTANT: also update the SOVERSION!!
|
# IMPORTANT: also update the JSONCPP_SOVERSION!!
|
||||||
VERSION 1.9.3 # <major>[.<minor>[.<patch>[.<tweak>]]]
|
VERSION 1.9.3 # <major>[.<minor>[.<patch>[.<tweak>]]]
|
||||||
LANGUAGES CXX)
|
LANGUAGES CXX)
|
||||||
|
|
||||||
message(STATUS "JsonCpp Version: ${JSONCPP_VERSION_MAJOR}.${JSONCPP_VERSION_MINOR}.${JSONCPP_VERSION_PATCH}")
|
message(STATUS "JsonCpp Version: ${JSONCPP_VERSION_MAJOR}.${JSONCPP_VERSION_MINOR}.${JSONCPP_VERSION_PATCH}")
|
||||||
set( JSONCPP_SOVERSION 22 )
|
set(JSONCPP_SOVERSION 23)
|
||||||
|
|
||||||
option(JSONCPP_WITH_TESTS "Compile and (for jsoncpp_check) run JsonCpp test executables" ON)
|
option(JSONCPP_WITH_TESTS "Compile and (for jsoncpp_check) run JsonCpp test executables" ON)
|
||||||
option(JSONCPP_WITH_POST_BUILD_UNITTEST "Automatically run unit-tests as a post build step" ON)
|
option(JSONCPP_WITH_POST_BUILD_UNITTEST "Automatically run unit-tests as a post build step" ON)
|
||||||
@ -95,13 +105,13 @@ include(GNUInstallDirs)
|
|||||||
|
|
||||||
set(DEBUG_LIBNAME_SUFFIX "" CACHE STRING "Optional suffix to append to the library name for a debug build")
|
set(DEBUG_LIBNAME_SUFFIX "" CACHE STRING "Optional suffix to append to the library name for a debug build")
|
||||||
|
|
||||||
set(JSONCPP_USE_SECURE_MEMORY "0" CACHE STRING "-D...=1 to use memory-wiping allocator for STL" )
|
set(JSONCPP_USE_SECURE_MEMORY "0" CACHE STRING "-D...=1 to use memory-wiping allocator for STL")
|
||||||
|
|
||||||
configure_file( "${PROJECT_SOURCE_DIR}/version.in"
|
configure_file("${PROJECT_SOURCE_DIR}/version.in"
|
||||||
"${PROJECT_BINARY_DIR}/version"
|
"${PROJECT_BINARY_DIR}/version"
|
||||||
NEWLINE_STYLE UNIX )
|
NEWLINE_STYLE UNIX)
|
||||||
|
|
||||||
macro(UseCompilationWarningAsError)
|
macro(use_compilation_warning_as_error)
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
# Only enabled in debug because some old versions of VS STL generate
|
# Only enabled in debug because some old versions of VS STL generate
|
||||||
# warnings when compiled in release configuration.
|
# warnings when compiled in release configuration.
|
||||||
@ -127,7 +137,7 @@ macro(UseCompilationWarningAsError)
|
|||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
# Include our configuration header
|
# Include our configuration header
|
||||||
include_directories( ${jsoncpp_SOURCE_DIR}/include )
|
include_directories(${jsoncpp_SOURCE_DIR}/include)
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
# Only enabled in debug because some old versions of VS STL generate
|
# Only enabled in debug because some old versions of VS STL generate
|
||||||
@ -157,9 +167,9 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|||||||
|
|
||||||
if(JSONCPP_WITH_STRICT_ISO)
|
if(JSONCPP_WITH_STRICT_ISO)
|
||||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12.0)
|
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12.0)
|
||||||
add_compile_options(-pedantic)
|
add_compile_options(-Wpedantic)
|
||||||
else()
|
else()
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpedantic")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if(JSONCPP_WITH_WARNING_AS_ERROR)
|
if(JSONCPP_WITH_WARNING_AS_ERROR)
|
||||||
@ -179,21 +189,15 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
|||||||
|
|
||||||
if(JSONCPP_WITH_STRICT_ISO AND NOT JSONCPP_WITH_WARNING_AS_ERROR)
|
if(JSONCPP_WITH_STRICT_ISO AND NOT JSONCPP_WITH_WARNING_AS_ERROR)
|
||||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12.0)
|
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12.0)
|
||||||
add_compile_options(-pedantic)
|
add_compile_options(-Wpedantic)
|
||||||
else()
|
else()
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpedantic")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_program(CCACHE_FOUND ccache)
|
|
||||||
if(CCACHE_FOUND)
|
|
||||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
|
|
||||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
|
|
||||||
endif(CCACHE_FOUND)
|
|
||||||
|
|
||||||
if(JSONCPP_WITH_WARNING_AS_ERROR)
|
if(JSONCPP_WITH_WARNING_AS_ERROR)
|
||||||
UseCompilationWarningAsError()
|
use_compilation_warning_as_error()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(JSONCPP_WITH_PKGCONFIG_SUPPORT)
|
if(JSONCPP_WITH_PKGCONFIG_SUPPORT)
|
||||||
@ -206,11 +210,11 @@ if(JSONCPP_WITH_PKGCONFIG_SUPPORT)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(JSONCPP_WITH_CMAKE_PACKAGE)
|
if(JSONCPP_WITH_CMAKE_PACKAGE)
|
||||||
include (CMakePackageConfigHelpers)
|
include(CMakePackageConfigHelpers)
|
||||||
install(EXPORT jsoncpp
|
install(EXPORT jsoncpp
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/jsoncpp
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/jsoncpp
|
||||||
FILE jsoncppConfig.cmake)
|
FILE jsoncppConfig.cmake)
|
||||||
write_basic_package_version_file ("${CMAKE_CURRENT_BINARY_DIR}/jsoncppConfigVersion.cmake"
|
write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/jsoncppConfigVersion.cmake"
|
||||||
VERSION ${PROJECT_VERSION}
|
VERSION ${PROJECT_VERSION}
|
||||||
COMPATIBILITY SameMajorVersion)
|
COMPATIBILITY SameMajorVersion)
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/jsoncppConfigVersion.cmake
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/jsoncppConfigVersion.cmake
|
||||||
@ -223,12 +227,12 @@ if(JSONCPP_WITH_TESTS)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Build the different applications
|
# Build the different applications
|
||||||
add_subdirectory( src )
|
add_subdirectory(src)
|
||||||
|
|
||||||
#install the includes
|
#install the includes
|
||||||
add_subdirectory( include )
|
add_subdirectory(include)
|
||||||
|
|
||||||
#install the example
|
#install the example
|
||||||
if(JSONCPP_WITH_EXAMPLE)
|
if(JSONCPP_WITH_EXAMPLE)
|
||||||
add_subdirectory( example )
|
add_subdirectory(example)
|
||||||
endif()
|
endif()
|
||||||
|
@ -6,7 +6,7 @@ set(EXAMPLES
|
|||||||
readFromStream
|
readFromStream
|
||||||
stringWrite
|
stringWrite
|
||||||
streamWrite
|
streamWrite
|
||||||
)
|
)
|
||||||
add_definitions(-D_GLIBCXX_USE_CXX11_ABI)
|
add_definitions(-D_GLIBCXX_USE_CXX11_ABI)
|
||||||
set_property(DIRECTORY PROPERTY COMPILE_OPTIONS ${EXTRA_CXX_FLAGS})
|
set_property(DIRECTORY PROPERTY COMPILE_OPTIONS ${EXTRA_CXX_FLAGS})
|
||||||
|
|
||||||
@ -17,10 +17,11 @@ else()
|
|||||||
-D_SCL_SECURE_NO_WARNINGS
|
-D_SCL_SECURE_NO_WARNINGS
|
||||||
-D_CRT_SECURE_NO_WARNINGS
|
-D_CRT_SECURE_NO_WARNINGS
|
||||||
-D_WIN32_WINNT=0x601
|
-D_WIN32_WINNT=0x601
|
||||||
-D_WINSOCK_DEPRECATED_NO_WARNINGS)
|
-D_WINSOCK_DEPRECATED_NO_WARNINGS
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
foreach (example ${EXAMPLES})
|
foreach(example ${EXAMPLES})
|
||||||
add_executable(${example} ${example}/${example}.cpp)
|
add_executable(${example} ${example}/${example}.cpp)
|
||||||
target_include_directories(${example} PUBLIC ${CMAKE_SOURCE_DIR}/include)
|
target_include_directories(${example} PUBLIC ${CMAKE_SOURCE_DIR}/include)
|
||||||
target_link_libraries(${example} jsoncpp_lib)
|
target_link_libraries(${example} jsoncpp_lib)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12.0)
|
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12.0)
|
||||||
# The new Python3 module is much more robust than the previous PythonInterp
|
# The new Python3 module is much more robust than the previous PythonInterp
|
||||||
find_package (Python3 COMPONENTS Interpreter)
|
find_package(Python3 COMPONENTS Interpreter)
|
||||||
# Set variables for backwards compatibility with cmake < 3.12.0
|
# Set variables for backwards compatibility with cmake < 3.12.0
|
||||||
set(PYTHONINTERP_FOUND ${Python3_Interpreter_FOUND})
|
set(PYTHONINTERP_FOUND ${Python3_Interpreter_FOUND})
|
||||||
set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
|
set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
|
||||||
@ -11,13 +11,13 @@ endif()
|
|||||||
|
|
||||||
add_executable(jsontestrunner_exe
|
add_executable(jsontestrunner_exe
|
||||||
main.cpp
|
main.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
if(BUILD_SHARED_LIBS)
|
if(BUILD_SHARED_LIBS)
|
||||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12.0)
|
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12.0)
|
||||||
add_compile_definitions( JSON_DLL )
|
add_compile_definitions( JSON_DLL )
|
||||||
else()
|
else()
|
||||||
add_definitions( -DJSON_DLL )
|
add_definitions(-DJSON_DLL)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(jsontestrunner_exe jsoncpp_lib)
|
target_link_libraries(jsontestrunner_exe jsoncpp_lib)
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
if( CMAKE_COMPILER_IS_GNUCXX )
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
#Get compiler version.
|
#Get compiler version.
|
||||||
execute_process( COMMAND ${CMAKE_CXX_COMPILER} -dumpversion
|
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion
|
||||||
OUTPUT_VARIABLE GNUCXX_VERSION )
|
OUTPUT_VARIABLE GNUCXX_VERSION
|
||||||
|
)
|
||||||
|
|
||||||
#-Werror=* was introduced -after- GCC 4.1.2
|
#-Werror=* was introduced -after- GCC 4.1.2
|
||||||
if( GNUCXX_VERSION VERSION_GREATER 4.1.2 )
|
if(GNUCXX_VERSION VERSION_GREATER 4.1.2)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=strict-aliasing")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=strict-aliasing")
|
||||||
endif()
|
endif()
|
||||||
endif( CMAKE_COMPILER_IS_GNUCXX )
|
endif()
|
||||||
|
|
||||||
include(CheckIncludeFileCXX)
|
include(CheckIncludeFileCXX)
|
||||||
include(CheckTypeSize)
|
include(CheckTypeSize)
|
||||||
@ -41,9 +42,9 @@ if(NOT (HAVE_CLOCALE AND HAVE_LCONV_SIZE AND HAVE_DECIMAL_POINT AND HAVE_LOCALEC
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set( JSONCPP_INCLUDE_DIR ../../include )
|
set(JSONCPP_INCLUDE_DIR ../../include)
|
||||||
|
|
||||||
set( PUBLIC_HEADERS
|
set(PUBLIC_HEADERS
|
||||||
${JSONCPP_INCLUDE_DIR}/json/config.h
|
${JSONCPP_INCLUDE_DIR}/json/config.h
|
||||||
${JSONCPP_INCLUDE_DIR}/json/forwards.h
|
${JSONCPP_INCLUDE_DIR}/json/forwards.h
|
||||||
${JSONCPP_INCLUDE_DIR}/json/json_features.h
|
${JSONCPP_INCLUDE_DIR}/json/json_features.h
|
||||||
@ -52,43 +53,44 @@ set( PUBLIC_HEADERS
|
|||||||
${JSONCPP_INCLUDE_DIR}/json/version.h
|
${JSONCPP_INCLUDE_DIR}/json/version.h
|
||||||
${JSONCPP_INCLUDE_DIR}/json/writer.h
|
${JSONCPP_INCLUDE_DIR}/json/writer.h
|
||||||
${JSONCPP_INCLUDE_DIR}/json/assertions.h
|
${JSONCPP_INCLUDE_DIR}/json/assertions.h
|
||||||
)
|
)
|
||||||
|
|
||||||
source_group( "Public API" FILES ${PUBLIC_HEADERS} )
|
source_group("Public API" FILES ${PUBLIC_HEADERS})
|
||||||
|
|
||||||
set(jsoncpp_sources
|
set(jsoncpp_sources
|
||||||
json_tool.h
|
json_tool.h
|
||||||
json_reader.cpp
|
json_reader.cpp
|
||||||
json_valueiterator.inl
|
json_valueiterator.inl
|
||||||
json_value.cpp
|
json_value.cpp
|
||||||
json_writer.cpp)
|
json_writer.cpp
|
||||||
|
)
|
||||||
|
|
||||||
# Install instructions for this target
|
# Install instructions for this target
|
||||||
if(JSONCPP_WITH_CMAKE_PACKAGE)
|
if(JSONCPP_WITH_CMAKE_PACKAGE)
|
||||||
set(INSTALL_EXPORT EXPORT jsoncpp)
|
set(INSTALL_EXPORT EXPORT jsoncpp)
|
||||||
else(JSONCPP_WITH_CMAKE_PACKAGE)
|
else()
|
||||||
set(INSTALL_EXPORT)
|
set(INSTALL_EXPORT)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
if(BUILD_SHARED_LIBS)
|
if(BUILD_SHARED_LIBS)
|
||||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12.0)
|
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12.0)
|
||||||
add_compile_definitions( JSON_DLL_BUILD )
|
add_compile_definitions(JSON_DLL_BUILD)
|
||||||
else()
|
else()
|
||||||
add_definitions( -DJSON_DLL_BUILD )
|
add_definitions(-DJSON_DLL_BUILD)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
add_library(jsoncpp_lib ${PUBLIC_HEADERS} ${jsoncpp_sources})
|
add_library(jsoncpp_lib ${PUBLIC_HEADERS} ${jsoncpp_sources})
|
||||||
set_target_properties( jsoncpp_lib PROPERTIES VERSION ${JSONCPP_VERSION} SOVERSION ${JSONCPP_SOVERSION})
|
set_target_properties(jsoncpp_lib PROPERTIES VERSION ${JSONCPP_VERSION} SOVERSION ${JSONCPP_SOVERSION})
|
||||||
set_target_properties( jsoncpp_lib PROPERTIES OUTPUT_NAME jsoncpp
|
set_target_properties(jsoncpp_lib PROPERTIES OUTPUT_NAME jsoncpp
|
||||||
DEBUG_OUTPUT_NAME jsoncpp${DEBUG_LIBNAME_SUFFIX} )
|
DEBUG_OUTPUT_NAME jsoncpp${DEBUG_LIBNAME_SUFFIX})
|
||||||
set_target_properties( jsoncpp_lib PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
set_target_properties(jsoncpp_lib PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||||
|
|
||||||
# Set library's runtime search path on OSX
|
# Set library's runtime search path on OSX
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
set_target_properties( jsoncpp_lib PROPERTIES INSTALL_RPATH "@loader_path/." )
|
set_target_properties(jsoncpp_lib PROPERTIES INSTALL_RPATH "@loader_path/.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Specify compiler features required when compiling a given target.
|
# Specify compiler features required when compiling a given target.
|
||||||
@ -141,14 +143,16 @@ target_compile_features(jsoncpp_lib PUBLIC
|
|||||||
cxx_variadic_templates # Variadic templates, as defined in N2242.
|
cxx_variadic_templates # Variadic templates, as defined in N2242.
|
||||||
)
|
)
|
||||||
|
|
||||||
install( TARGETS jsoncpp_lib ${INSTALL_EXPORT}
|
install(TARGETS jsoncpp_lib ${INSTALL_EXPORT}
|
||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
)
|
||||||
|
|
||||||
if(NOT CMAKE_VERSION VERSION_LESS 2.8.11)
|
if(NOT CMAKE_VERSION VERSION_LESS 2.8.11)
|
||||||
target_include_directories( jsoncpp_lib PUBLIC
|
target_include_directories(jsoncpp_lib PUBLIC
|
||||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/${JSONCPP_INCLUDE_DIR}>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/${JSONCPP_INCLUDE_DIR}>
|
||||||
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include/json>)
|
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include/json>
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
# vim: et ts=4 sts=4 sw=4 tw=0
|
# vim: et ts=4 sts=4 sw=4 tw=0
|
||||||
|
|
||||||
add_executable( jsoncpp_test
|
add_executable(jsoncpp_test
|
||||||
jsontest.cpp
|
jsontest.cpp
|
||||||
jsontest.h
|
jsontest.h
|
||||||
fuzz.cpp
|
fuzz.cpp
|
||||||
fuzz.h
|
fuzz.h
|
||||||
main.cpp
|
main.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
if(BUILD_SHARED_LIBS)
|
if(BUILD_SHARED_LIBS)
|
||||||
@ -27,15 +27,17 @@ if(JSONCPP_WITH_POST_BUILD_UNITTEST)
|
|||||||
if(BUILD_SHARED_LIBS)
|
if(BUILD_SHARED_LIBS)
|
||||||
# First, copy the shared lib, for Microsoft.
|
# First, copy the shared lib, for Microsoft.
|
||||||
# Then, run the test executable.
|
# Then, run the test executable.
|
||||||
add_custom_command( TARGET jsoncpp_test
|
add_custom_command(TARGET jsoncpp_test
|
||||||
POST_BUILD
|
POST_BUILD
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:jsoncpp_lib> $<TARGET_FILE_DIR:jsoncpp_test>
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:jsoncpp_lib> $<TARGET_FILE_DIR:jsoncpp_test>
|
||||||
COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:jsoncpp_test>)
|
COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:jsoncpp_test>
|
||||||
else(BUILD_SHARED_LIBS)
|
)
|
||||||
|
else()
|
||||||
# Just run the test executable.
|
# Just run the test executable.
|
||||||
add_custom_command( TARGET jsoncpp_test
|
add_custom_command(TARGET jsoncpp_test
|
||||||
POST_BUILD
|
POST_BUILD
|
||||||
COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:jsoncpp_test>)
|
COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:jsoncpp_test>
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
## Create tests for dashboard submission, allows easy review of CI results https://my.cdash.org/index.php?project=jsoncpp
|
## Create tests for dashboard submission, allows easy review of CI results https://my.cdash.org/index.php?project=jsoncpp
|
||||||
add_test(NAME jsoncpp_test
|
add_test(NAME jsoncpp_test
|
||||||
|
Loading…
Reference in New Issue
Block a user