Compile simple_parse example for CMake project.

This commit is contained in:
Joakim Soderberg 2015-01-13 16:17:48 +01:00
parent c244b1483e
commit d0a8ad4c06

View File

@ -61,6 +61,8 @@ if (MSVC)
option(JANSSON_STATIC_CRT "Link the static CRT libraries" OFF ) option(JANSSON_STATIC_CRT "Link the static CRT libraries" OFF )
endif () endif ()
option(JANSSON_EXAMPLES "Compile example applications" ON)
if (UNIX) if (UNIX)
option(JANSSON_COVERAGE "(GCC Only! Requires gcov/lcov to be installed). Include target for doing coverage analysis for the test suite. Note that -DCMAKE_BUILD_TYPE=Debug must be set" OFF) option(JANSSON_COVERAGE "(GCC Only! Requires gcov/lcov to be installed). Include target for doing coverage analysis for the test suite. Note that -DCMAKE_BUILD_TYPE=Debug must be set" OFF)
option(JANSSON_COVERALLS "Generate coverage info for Coveralls" OFF) option(JANSSON_COVERALLS "Generate coverage info for Coveralls" OFF)
@ -78,7 +80,6 @@ set(JANSSON_TEMP_DIR ${PROJECT_BINARY_DIR}/tmp)
# same build-tree on Windows (MSVC). # same build-tree on Windows (MSVC).
if (WIN32) if (WIN32)
set(CMAKE_DEBUG_POSTFIX "_d") set(CMAKE_DEBUG_POSTFIX "_d")
else (WIN32)
endif (WIN32) endif (WIN32)
# This is how I thought it should go # This is how I thought it should go
@ -385,6 +386,10 @@ else()
${JANSSON_HDR_PUBLIC}) ${JANSSON_HDR_PUBLIC})
endif() endif()
if (JANSSON_EXAMPLES)
add_executable(simple_parse "${PROJECT_SOURCE_DIR}/examples/simple_parse.c")
target_link_libraries(simple_parse jansson)
endif()
# For building Documentation (uses Sphinx) # For building Documentation (uses Sphinx)
option(JANSSON_BUILD_DOCS "Build documentation (uses python-sphinx)." ON) option(JANSSON_BUILD_DOCS "Build documentation (uses python-sphinx)." ON)