Added Visual Studio guards and fixed missing include

This commit is contained in:
Magne Sjaastad 2016-05-24 15:02:36 +02:00
parent 2da7093a35
commit f77866bf68
3 changed files with 20 additions and 13 deletions

View File

@ -34,19 +34,21 @@ include(CheckIncludeFileCXX)
# macro to only add option once
include(AddOptions)
# try to use compiler flag -std=c++11
CHECK_CXX_ACCEPTS_FLAG("-std=c++11" CXX_FLAG_CXX11)
if(CXX_FLAG_CXX11)
add_options (CXX ALL_BUILDS "-std=c++11")
set(CXX_STD0X_FLAGS "-std=c++11")
else()
# try to use compiler flag -std=c++0x for older compilers
CHECK_CXX_ACCEPTS_FLAG("-std=c++0x" CXX_FLAG_CXX0X)
if(CXX_FLAG_CXX0X)
add_options (CXX ALL_BUILDS "-std=c++0x")
set(CXX_STD0X_FLAGS "-std=c++0x")
endif(CXX_FLAG_CXX0X)
endif(CXX_FLAG_CXX11)
if(NOT MSVC)
# try to use compiler flag -std=c++11
CHECK_CXX_ACCEPTS_FLAG("-std=c++11" CXX_FLAG_CXX11)
if(CXX_FLAG_CXX11)
add_options (CXX ALL_BUILDS "-std=c++11")
set(CXX_STD0X_FLAGS "-std=c++11")
else()
# try to use compiler flag -std=c++0x for older compilers
CHECK_CXX_ACCEPTS_FLAG("-std=c++0x" CXX_FLAG_CXX0X)
if(CXX_FLAG_CXX0X)
add_options (CXX ALL_BUILDS "-std=c++0x")
set(CXX_STD0X_FLAGS "-std=c++0x")
endif(CXX_FLAG_CXX0X)
endif(CXX_FLAG_CXX11)
endif(NOT MSVC)
# if we are building with an Apple toolchain in MacOS X,
# we cannot use the old GCC 4.2 fork, but must use the

View File

@ -2,6 +2,10 @@
# compiler/linker. first parameter is the name of the variable that will
# receive this list, the rest is considered the list of libraries
function (linker_cmdline what INTO outvar FROM)
if (NOT (UNIX OR MSYS OR MINGW))
return ()
endif (NOT (UNIX OR MSYS OR MINGW))
# if we are going to put these in regexps, we must escape period
string (REPLACE "." "\\." esc_dl_pref "${CMAKE_SHARED_LIBRARY_PREFIX}")
string (REPLACE "." "\\." esc_dl_suff "${CMAKE_SHARED_LIBRARY_SUFFIX}")

View File

@ -24,6 +24,7 @@
#include <vector>
#include <type_traits>
#include <cmath>
#include <algorithm>
namespace Opm {