summaryrefslogtreecommitdiffstats
path: root/Modules/TestCXXAcceptsFlag.cmake
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2002-11-21 17:52:54 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2002-11-21 17:52:54 (GMT)
commit9a6c95fcea52bd1b5b4930fdac0a48088e55273b (patch)
tree25daf13b3701dcedcd1210e79dfcae42946a6043 /Modules/TestCXXAcceptsFlag.cmake
parentb8a1b1e9e7adcc69d26d6fefaf6da059580afdba (diff)
downloadCMake-9a6c95fcea52bd1b5b4930fdac0a48088e55273b.zip
CMake-9a6c95fcea52bd1b5b4930fdac0a48088e55273b.tar.gz
CMake-9a6c95fcea52bd1b5b4930fdac0a48088e55273b.tar.bz2
add checks for ansi flags and not hard code them
Diffstat (limited to 'Modules/TestCXXAcceptsFlag.cmake')
-rw-r--r--Modules/TestCXXAcceptsFlag.cmake20
1 files changed, 20 insertions, 0 deletions
diff --git a/Modules/TestCXXAcceptsFlag.cmake b/Modules/TestCXXAcceptsFlag.cmake
new file mode 100644
index 0000000..1c6f351
--- /dev/null
+++ b/Modules/TestCXXAcceptsFlag.cmake
@@ -0,0 +1,20 @@
+#
+# Check if the CXX compiler accepts a flag
+#
+# CHECK_FUNCTION_EXISTS - macro which checks if the function exists
+# FLAG - the flags to try
+# VARIABLE - variable to store the result
+#
+
+MACRO(CHECK_CXX_ACCEPTS_FLAG FLAGS VARIABLE)
+ MESSAGE(STATUS "Checking to see if CXX compiler acepts flag ${FLAGS}")
+ TRY_COMPILE(${VARIABLE}
+ ${PROJECT_BINARY_DIR}
+ ${CMAKE_ROOT}/Modules/DummyCXXFile.cxx
+ CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${FLAGS}
+ OUTPUT_VARIABLE OUTPUT)
+ IF(NOT ${VARIABLE})
+ WRITE_FILE(${PROJECT_BINARY_DIR}/CMakeError.log
+ "Determining if the CXX compiler accepts the flag ${FLAGS} failed with the following output:\n" "${OUTPUT}\n" APPEND)
+ ENDIF(NOT ${VARIABLE})
+ENDMACRO(CHECK_CXX_ACCEPTS_FLAG)