summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/try_compile/CStandardGNU.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-12-07 14:22:22 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2016-12-07 14:22:22 (GMT)
commita0d64ecf8b9eac29cbfeb7461cf3bcb1688f7aa7 (patch)
tree99011b6e805e6032e1679d0fa98ecd5f8e846458 /Tests/RunCMake/try_compile/CStandardGNU.cmake
parent0478314e13e6d04a0100cc3be4ab84540a8beaa5 (diff)
parentf72ba42b7c643b1b217d1b8f6684cec3289e7201 (diff)
downloadCMake-a0d64ecf8b9eac29cbfeb7461cf3bcb1688f7aa7.zip
CMake-a0d64ecf8b9eac29cbfeb7461cf3bcb1688f7aa7.tar.gz
CMake-a0d64ecf8b9eac29cbfeb7461cf3bcb1688f7aa7.tar.bz2
Merge topic 'try_compile-lang-std'
f72ba42b try_compile: Add policy CMP0067 to honor language standards 45aa03b9 try_compile: Add options to specify language standards 3bb2051e try_compile: Stop processing when test build system fails to generate
Diffstat (limited to 'Tests/RunCMake/try_compile/CStandardGNU.cmake')
-rw-r--r--Tests/RunCMake/try_compile/CStandardGNU.cmake23
1 files changed, 23 insertions, 0 deletions
diff --git a/Tests/RunCMake/try_compile/CStandardGNU.cmake b/Tests/RunCMake/try_compile/CStandardGNU.cmake
new file mode 100644
index 0000000..79ae874
--- /dev/null
+++ b/Tests/RunCMake/try_compile/CStandardGNU.cmake
@@ -0,0 +1,23 @@
+enable_language(C)
+try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
+ SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CStandardGNU.c
+ C_STANDARD 99
+ C_STANDARD_REQUIRED 1
+ C_EXTENSIONS 0
+ OUTPUT_VARIABLE out
+ )
+if(NOT result)
+ message(FATAL_ERROR "try_compile failed:\n${out}")
+endif()
+
+cmake_policy(SET CMP0067 NEW)
+set(CMAKE_C_STANDARD 99)
+set(CMAKE_C_STANDARD_REQUIRED 1)
+set(CMAKE_C_EXTENSIONS 0)
+try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
+ SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CStandardGNU.c
+ OUTPUT_VARIABLE out
+ )
+if(NOT result)
+ message(FATAL_ERROR "try_compile failed:\n${out}")
+endif()