Skip to content

Commit

Permalink
allow the CMAKE_CXX_STANDARD could be set in the command line (#27)
Browse files Browse the repository at this point in the history
* allow the CMAKE_CXX_STANDARD could be set in the command line, such as -DCMAKE_CXX_STANDARD=17.

* update the doc.

* WIP: avoid the hardcode of c++ standard in sniper-config.
  • Loading branch information
mirguest authored Sep 18, 2021
1 parent a95739f commit 610a6e6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ if(WIN32)
endif()

# Compiler and Linker Settings
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 11 CACHE STRING "")
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ There are more cmake options we can use while configuring the build:
* `-DUSE_PYTHON=ON` : Build the project with Python support. A pure C++ version will be built if it is turned off. The default value is `ON`.
* `-DUSE_PYTHON2=OFF` : Turn it on to use Python2, otherwise Python3 is used by default.
* `-DUSE_ROOT=ON` : Build components that depend on ROOT. The default value is `ON`.
* `-DCMAKE_CXX_STANDARD=11|14|17` : specify the C++ standard 11, 14, 17 or newer.

Then build and install the result. Default build agent is `make` and you can call it directly.

Expand Down
2 changes: 1 addition & 1 deletion cmake/sniper-config.in
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ while test $# -gt 0; do
;;

--cflags)
echo "-std=c++11 -fPIC -I$includedir -I@Boost_INCLUDE_DIR@ -I@PYTHON_INCLUDE_DIRS@"
echo "-std=c++@CMAKE_CXX_STANDARD@ -fPIC -I$includedir -I@Boost_INCLUDE_DIR@ -I@PYTHON_INCLUDE_DIRS@"
;;

--libdir)
Expand Down

0 comments on commit 610a6e6

Please sign in to comment.