diff options
| author | Charles Karney <charles.karney@sri.com> | 2019-09-19 09:25:09 -0400 |
|---|---|---|
| committer | Charles Karney <charles.karney@sri.com> | 2019-09-19 09:25:09 -0400 |
| commit | 1c2f375033afb0a4eb57c978222db2feeb148f43 (patch) | |
| tree | 5f1644142a32d3fc47a7a3592860dbe48dea4638 /CMakeLists.txt | |
| parent | 8948068deaa8b1b9cf14e7e509d06abc3a0b8dcf (diff) | |
| download | PROJ-1c2f375033afb0a4eb57c978222db2feeb148f43.tar.gz PROJ-1c2f375033afb0a4eb57c978222db2feeb148f43.zip | |
Require C99 compiler see #1621
cmake and autoconf now stipulate C99
change c89 to c99 in travis jobs
remove HAVE_C99_MATH checks
(unrelated) relax Visual Studio compatibility check in
cmake/project-config-version.cmake.in (VS 2019 can use a VS 2015 library
but not vice versa).
Diffstat (limited to 'CMakeLists.txt')
| -rw-r--r-- | CMakeLists.txt | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f463078..63f516a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,15 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) message(STATUS "Requiring C++${CMAKE_CXX_STANDARD} - done") +# Set C99 version +# Make CMAKE_C_STANDARD available as cache option overridable by user +set(CMAKE_C_STANDARD 99 + CACHE STRING "C standard version to use (default is 99)") +message(STATUS "Requiring C${CMAKE_C_STANDARD}") +set(CMAKE_C_STANDARD_REQUIRED ON) +set(CMAKE_C_EXTENSIONS OFF) +message(STATUS "Requiring C${CMAKE_C_STANDARD} - done") + # Set global -fvisibility=hidden set(CMAKE_C_VISIBILITY_PRESET hidden) set(CMAKE_CXX_VISIBILITY_PRESET hidden) @@ -52,7 +61,6 @@ elseif("${CMAKE_C_COMPILER_ID}" MATCHES "Clang") set(PROJ_C_WARN_FLAGS ${PROJ_common_WARN_FLAGS} -Wmissing-prototypes -Wfloat-conversion - -Wc99-extensions -Wc11-extensions ) set(PROJ_CXX_WARN_FLAGS ${PROJ_common_WARN_FLAGS} @@ -134,21 +142,6 @@ else() set(CMAKE_REQUIRED_LIBRARIES m) set(CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} -Werror -Wall") endif() -# Check whether the C99 math function: hypot, atanh, etc. are available. -check_c_source_compiles(" -#include <math.h> -int main() { - int q; - return (int)(hypot(3.0, 4.0) + atanh(0.8) + copysign(1.0, -0.0) + - cbrt(8.0) + remainder(100.0, 90.0) + - remquo(100.0, 90.0, &q)); -} -" C99_MATH) -if(C99_MATH) - add_definitions(-DHAVE_C99_MATH=1) -else() - add_definitions(-DHAVE_C99_MATH=0) -endif() if(Threads_FOUND AND CMAKE_USE_PTHREADS_INIT) set(CMAKE_REQUIRED_LIBRARIES |
