Skip to content

Commit

Permalink
C++11 (#5)
Browse files Browse the repository at this point in the history
* c++11

* c++11
  • Loading branch information
Danielhiversen authored Oct 1, 2017
1 parent 5268424 commit 412836e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
13 changes: 12 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
project(org_custusx_anglecorrection)

#### Enable C++11
set (CMAKE_CXX_STANDARD 11)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR CMAKE_COMPILER_IS_GNUCXX)
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(--std=c++11 SUPPORTS_STD_CXX11)
check_cxx_compiler_flag(--std=c++0x SUPPORTS_STD_CXX01)
if(SUPPORTS_STD_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11")
elseif(SUPPORTS_STD_CXX01)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++0x")
else()
message(ERROR "Compiler does not support --std=c++11 or --std=c++0x.")
endif()
endif()

add_subdirectory(core)

Expand Down
13 changes: 13 additions & 0 deletions core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,19 @@ target_include_directories (AngleCorr PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${PROJECT_SOURCE_DIR})

if(NOT hasParent)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR CMAKE_COMPILER_IS_GNUCXX)
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(--std=c++11 SUPPORTS_STD_CXX11)
check_cxx_compiler_flag(--std=c++0x SUPPORTS_STD_CXX01)
if(SUPPORTS_STD_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11")
elseif(SUPPORTS_STD_CXX01)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++0x")
else()
message(ERROR "Compiler does not support --std=c++11 or --std=c++0x.")
endif()
endif()

add_executable(angle_correction main.cpp )
target_link_libraries(angle_correction AngleCorr)

Expand Down

0 comments on commit 412836e

Please sign in to comment.