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
2fc1f694
Unverified
Commit
2fc1f694
authored
4 years ago
by
Niels Lohmann
Committed by
GitHub
4 years ago
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2514 from globberwops/develop
Add MAIN_PROJECT check for test and install options
parents
85ffc85a
1771e924
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
CMakeLists.txt
CMakeLists.txt
+13
-5
No files found.
CMakeLists.txt
View file @
2fc1f694
...
@@ -6,6 +6,15 @@ cmake_minimum_required(VERSION 3.1)
...
@@ -6,6 +6,15 @@ cmake_minimum_required(VERSION 3.1)
##
##
project
(
nlohmann_json VERSION 3.9.1 LANGUAGES CXX
)
project
(
nlohmann_json VERSION 3.9.1 LANGUAGES CXX
)
##
## MAIN_PROJECT CHECK
## determine if nlohmann_json is built as a subproject (using add_subdirectory) or if it is the main project
##
set
(
MAIN_PROJECT OFF
)
if
(
CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR
)
set
(
MAIN_PROJECT ON
)
endif
()
##
##
## INCLUDE
## INCLUDE
##
##
...
@@ -21,8 +30,8 @@ if (POLICY CMP0077)
...
@@ -21,8 +30,8 @@ if (POLICY CMP0077)
cmake_policy
(
SET CMP0077 NEW
)
cmake_policy
(
SET CMP0077 NEW
)
endif
()
endif
()
option
(
JSON_BuildTests
"Build the unit tests when BUILD_TESTING is enabled."
ON
)
option
(
JSON_BuildTests
"Build the unit tests when BUILD_TESTING is enabled."
${
MAIN_PROJECT
}
)
option
(
JSON_Install
"Install CMake targets during install step."
ON
)
option
(
JSON_Install
"Install CMake targets during install step."
${
MAIN_PROJECT
}
)
option
(
JSON_MultipleHeaders
"Use non-amalgamated version of the library."
OFF
)
option
(
JSON_MultipleHeaders
"Use non-amalgamated version of the library."
OFF
)
option
(
JSON_ImplicitConversions
"Enable implicit conversions."
ON
)
option
(
JSON_ImplicitConversions
"Enable implicit conversions."
ON
)
...
@@ -101,9 +110,8 @@ CONFIGURE_FILE(
...
@@ -101,9 +110,8 @@ CONFIGURE_FILE(
## TESTS
## TESTS
## create and configure the unit test target
## create and configure the unit test target
##
##
include
(
CTest
)
#adds option BUILD_TESTING (default ON)
if
(
JSON_BuildTests
)
include
(
CTest
)
if
(
BUILD_TESTING AND JSON_BuildTests
)
enable_testing
()
enable_testing
()
add_subdirectory
(
test
)
add_subdirectory
(
test
)
endif
()
endif
()
...
...
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