Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
json
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
json
Commits
73cc5089
Commit
73cc5089
authored
7 years ago
by
Kevin Tonon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Using target_compile_features to specify C++ 11 standard
parent
d2dd27dc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
8 deletions
+9
-8
CMakeLists.txt
CMakeLists.txt
+3
-1
benchmarks/CMakeLists.txt
benchmarks/CMakeLists.txt
+3
-2
test/CMakeLists.txt
test/CMakeLists.txt
+3
-5
No files found.
CMakeLists.txt
View file @
73cc5089
cmake_minimum_required
(
VERSION 3.
0.0
)
cmake_minimum_required
(
VERSION 3.
8
)
##
## PROJECT
...
...
@@ -44,6 +44,8 @@ endif()
##
add_library
(
${
NLOHMANN_JSON_TARGET_NAME
}
INTERFACE
)
target_compile_features
(
${
NLOHMANN_JSON_TARGET_NAME
}
INTERFACE cxx_std_11
)
target_include_directories
(
${
NLOHMANN_JSON_TARGET_NAME
}
INTERFACE
...
...
This diff is collapsed.
Click to expand it.
benchmarks/CMakeLists.txt
View file @
73cc5089
cmake_minimum_required
(
VERSION 3.
0
)
cmake_minimum_required
(
VERSION 3.
8
)
project
(
JSON_Benchmarks LANGUAGES CXX
)
# set compiler flags
if
((
CMAKE_CXX_COMPILER_ID MATCHES GNU
)
OR
(
CMAKE_CXX_COMPILER_ID MATCHES Clang
))
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-
std=c++11 -
flto -DNDEBUG -O3"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-flto -DNDEBUG -O3"
)
endif
()
# configure Google Benchmarks
...
...
@@ -23,4 +23,5 @@ file(COPY ${CMAKE_SOURCE_DIR}/../test/data/regression/floats.json
# benchmark binary
add_executable
(
json_benchmarks src/benchmarks.cpp
)
target_compile_features
(
json_benchmarks PRIVATE cxx_std_11
)
target_link_libraries
(
json_benchmarks benchmark
${
CMAKE_THREAD_LIBS_INIT
}
)
This diff is collapsed.
Click to expand it.
test/CMakeLists.txt
View file @
73cc5089
...
...
@@ -6,7 +6,7 @@ option(JSON_Coverage "Build test suite with coverage information" OFF)
if
(
JSON_Sanitizer
)
message
(
STATUS
"Building test suite with Clang sanitizer"
)
if
(
NOT MSVC
)
set
(
CMAKE_CXX_FLAGS
"-
std=c++11 -
g -O2 -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer"
)
set
(
CMAKE_CXX_FLAGS
"-g -O2 -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer"
)
endif
()
endif
()
...
...
@@ -62,11 +62,10 @@ add_library(catch_main OBJECT
"src/unit.cpp"
)
set_target_properties
(
catch_main PROPERTIES
CXX_STANDARD 11
CXX_STANDARD_REQUIRED ON
COMPILE_DEFINITIONS
"$<$<CXX_COMPILER_ID:MSVC>:_SCL_SECURE_NO_WARNINGS>"
COMPILE_OPTIONS
"$<$<CXX_COMPILER_ID:MSVC>:/EHsc;$<$<CONFIG:Release>:/Od>>"
)
target_compile_features
(
catch_main PUBLIC cxx_std_11
)
target_include_directories
(
catch_main PRIVATE
"thirdparty/catch"
)
# https://stackoverflow.com/questions/2368811/how-to-set-warning-level-in-cmake
...
...
@@ -96,13 +95,12 @@ foreach(file ${files})
add_executable
(
${
testcase
}
$<TARGET_OBJECTS:catch_main>
${
file
}
)
set_target_properties
(
${
testcase
}
PROPERTIES
CXX_STANDARD 11
CXX_STANDARD_REQUIRED ON
COMPILE_DEFINITIONS
"$<$<CXX_COMPILER_ID:MSVC>:_SCL_SECURE_NO_WARNINGS>"
COMPILE_OPTIONS
"$<$<CXX_COMPILER_ID:MSVC>:/EHsc;$<$<CONFIG:Release>:/Od>>"
)
target_compile_definitions
(
${
testcase
}
PRIVATE CATCH_CONFIG_FAST_COMPILE
)
target_compile_features
(
${
testcase
}
PRIVATE cxx_std_11
)
target_include_directories
(
${
testcase
}
PRIVATE
"thirdparty/catch"
)
target_include_directories
(
${
testcase
}
PRIVATE
"thirdparty/fifo_map"
)
target_include_directories
(
${
testcase
}
PRIVATE
${
NLOHMANN_JSON_INCLUDE_BUILD_DIR
}
)
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment