Skip to content

Commit

Permalink
Set C++11 flags with CMAKE_CXX_STANDARD
Browse files Browse the repository at this point in the history
Don't rely on compiler-specific flags, but outsource this work to cmake.
  • Loading branch information
jokva committed Jun 3, 2019
1 parent b9e006a commit c6863f9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ endif()
if (NOT MSVC)
# assuming gcc-style options
set(c99 -std=c99)
set(c++11 -std=c++11)
# add warnings in debug mode
list(APPEND warnings-c -Wall -Wextra -pedantic -Wformat-nonliteral
-Wcast-align -Wpointer-arith -Wmissing-declarations
Expand Down
3 changes: 2 additions & 1 deletion applications/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ if( NOT HAVE_GETOPT_H OR NOT HAVE_GETOPT_LONG )
return ()
endif ()

set(CMAKE_CXX_STANDARD 11)

add_library(apputils STATIC apputils.c)
target_link_libraries(apputils segyio)
target_compile_options(apputils BEFORE
Expand Down Expand Up @@ -60,7 +62,6 @@ target_link_libraries(flip-endianness segyio)
target_compile_options(flip-endianness BEFORE
PRIVATE
$<$<CONFIG:Debug>:${warnings-c}>
${c++11}
)

install(TARGETS segyio-cath
Expand Down
3 changes: 2 additions & 1 deletion lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
cmake_minimum_required(VERSION 3.5)
project(libsegyio C CXX)

set(CMAKE_CXX_STANDARD 11)

if(MSVC)
set(DLL_EXPORT_FILES src/segy.def)
endif()
Expand Down Expand Up @@ -109,7 +111,6 @@ target_include_directories(c.segy PRIVATE src experimental)
target_link_libraries(c.segy catch2 segyio)
target_compile_options(c.segy BEFORE
PRIVATE
${c++11}
${mmap}
$<$<CONFIG:Debug>:${warnings-c}>
)
Expand Down

0 comments on commit c6863f9

Please sign in to comment.