changed: probe for compiler flags

increases portability (e.g. pgc)
This commit is contained in:
Arne Morten Kvarving committed 2017-05-05 10:05:35 +02:00
1 parent 95c4434c4f
commit 508dc6acb1
2 files changed
+10 -7

No files matched your search

-7
View File
@@ -73,13 +73,6 @@ if(NOT CMAKE_INSTALL_DOCDIR)
set(CMAKE_INSTALL_DOCDIR share/doc/libifem1)
endif()
if(NOT WIN32)
# Emit position-independent code, suitable for dynamic linking
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
# Enable all warnings
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-parentheses")
endif()
# Generate build flags in build tree
configure_file(${PROJECT_SOURCE_DIR}/cmake/Modules/IFEMFlags.cmake.in
IFEMFlags.cmake @ONLY)
+10
View File
@@ -252,3 +252,13 @@ set(IFEM_CHECKCOMMITS_SCRIPT ${IFEM_PATH}/cmake/Scripts/CheckCommits.cmake)
if(NOT CMAKE_INSTALL_DOCDIR)
set(CMAKE_INSTALL_DOCDIR libifem1)
endif()
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-Wall HAS_WALL)
check_cxx_compiler_flag(-Wno-parentheses HAS_PARENTHESES)
if(HAS_WALL)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
endif()
if(HAS_PARENTHESES)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-parentheses")
endif()