Re: [cmake-developers] [PATCH] fix use of CMAKE_REQUIRED_DEFINITIONS

2015-07-08 Thread Brad King
On 02/24/2015 09:47 AM, Brad King wrote:
> On 02/24/2015 08:25 AM, Mark Abraham wrote:
>> Some modules shoud use CMAKE_REQUIRED_FLAGS, not CMAKE_REQUIRED_DEFINITIONS, 
>> I think.
> 
> Actually both technically support any flags, but the latter
> only for legacy reasons.  I agree CMAKE_REQUIRED_FLAGS is
> clearer for this purpose.  I've applied the patch with
> minor tweaks:
> 
>  Check*CompilerFlag: Refactor method used to pass flags
>  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5d5067ae

We need to revert this change from 3.3 because it caused a regression:

 In CMake 3.3.0-rc3 macro CHECK_CXX_COMPILER_FLAG is broken on OSX for some 
flags
 https://public.kitware.com/Bug/view.php?id=15641

See issue tracker entry for further updates.

-Brad

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers


Re: [cmake-developers] [PATCH] fix use of CMAKE_REQUIRED_DEFINITIONS

2015-02-24 Thread Brad King
On 02/24/2015 08:25 AM, Mark Abraham wrote:
> Some modules shoud use CMAKE_REQUIRED_FLAGS, not CMAKE_REQUIRED_DEFINITIONS, 
> I think.

Actually both technically support any flags, but the latter
only for legacy reasons.  I agree CMAKE_REQUIRED_FLAGS is
clearer for this purpose.  I've applied the patch with
minor tweaks:

 Check*CompilerFlag: Refactor method used to pass flags
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5d5067ae

Thanks,
-Brad

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers


[cmake-developers] [PATCH] fix use of CMAKE_REQUIRED_DEFINITIONS

2015-02-24 Thread Mark Abraham
Hi,

Some modules shoud use CMAKE_REQUIRED_FLAGS, not
CMAKE_REQUIRED_DEFINITIONS, I think.

Mark
From ed93849e9635a67f6d8ae4256f9a8d8f13c1b8bb Mon Sep 17 00:00:00 2001
From: Mark Abraham 
Date: Tue, 24 Feb 2015 14:20:16 +0100
Subject: [PATCH] Fix incorrect use of CMAKE_REQUIRED_DEFINITIONS

Variable CMAKE_REQUIRED_FLAGS should be used by
Check*CompilerFlag.cmake modules to check for valid flags,
per documentation of the Check*SourceCompiles.cmake
modules that they call.
---
 Modules/CheckCCompilerFlag.cmake   | 6 +++---
 Modules/CheckCXXCompilerFlag.cmake | 8 
 Modules/CheckFortranCompilerFlag.cmake | 8 
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/Modules/CheckCCompilerFlag.cmake b/Modules/CheckCCompilerFlag.cmake
index 53f3454..4335641 100644
--- a/Modules/CheckCCompilerFlag.cmake
+++ b/Modules/CheckCCompilerFlag.cmake
@@ -38,8 +38,8 @@ include(CheckCSourceCompiles)
 include(CMakeCheckCompilerFlagCommonPatterns)
 
 macro (CHECK_C_COMPILER_FLAG _FLAG _RESULT)
-   set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
-   set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
+   set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
+   set(CMAKE_REQUIRED_FLAGS "${_FLAG}")
 
# Normalize locale during test compilation.
set(_CheckCCompilerFlag_LOCALE_VARS LC_ALL LC_MESSAGES LANG)
@@ -60,5 +60,5 @@ macro (CHECK_C_COMPILER_FLAG _FLAG _RESULT)
unset(_CheckCCompilerFlag_LOCALE_VARS)
unset(_CheckCCompilerFlag_COMMON_PATTERNS)
 
-   set (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
+   set (CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
 endmacro ()
diff --git a/Modules/CheckCXXCompilerFlag.cmake b/Modules/CheckCXXCompilerFlag.cmake
index fab3a05..71b3fd2 100644
--- a/Modules/CheckCXXCompilerFlag.cmake
+++ b/Modules/CheckCXXCompilerFlag.cmake
@@ -12,7 +12,7 @@
 # - variable to store the result
 #
 # This internally calls the check_cxx_source_compiles macro and sets
-# CMAKE_REQUIRED_DEFINITIONS to .  See help for
+# CMAKE_REQUIRED_FLAGS to .  See help for
 # CheckCXXSourceCompiles for a listing of variables that can otherwise
 # modify the build.  The result only tells that the compiler does not
 # give an error message when it encounters the flag.  If the flag has
@@ -37,8 +37,8 @@ include(CheckCXXSourceCompiles)
 include(CMakeCheckCompilerFlagCommonPatterns)
 
 macro (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT)
-   set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
-   set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
+   set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
+   set(CMAKE_REQUIRED_FLAGS "${_FLAG}")
 
# Normalize locale during test compilation.
set(_CheckCXXCompilerFlag_LOCALE_VARS LC_ALL LC_MESSAGES LANG)
@@ -59,6 +59,6 @@ macro (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT)
unset(_CheckCXXCompilerFlag_LOCALE_VARS)
unset(_CheckCXXCompilerFlag_COMMON_PATTERNS)
 
-   set (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
+   set (CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
 endmacro ()
 
diff --git a/Modules/CheckFortranCompilerFlag.cmake b/Modules/CheckFortranCompilerFlag.cmake
index 53fd8d6..c476661 100644
--- a/Modules/CheckFortranCompilerFlag.cmake
+++ b/Modules/CheckFortranCompilerFlag.cmake
@@ -13,7 +13,7 @@
 #Will be created as an internal cache variable.
 #
 # This internally calls the check_fortran_source_compiles macro and
-# sets CMAKE_REQUIRED_DEFINITIONS to .  See help for
+# sets CMAKE_REQUIRED_FLAGS to .  See help for
 # CheckFortranSourceCompiles for a listing of variables that can
 # otherwise modify the build.  The result only tells that the compiler
 # does not give an error message when it encounters the flag.  If the
@@ -40,8 +40,8 @@ include(CheckFortranSourceCompiles)
 include(CMakeCheckCompilerFlagCommonPatterns)
 
 macro (CHECK_Fortran_COMPILER_FLAG _FLAG _RESULT)
-  set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
-  set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
+  set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
+  set(CMAKE_REQUIRED_FLAGS "${_FLAG}")
 
   # Normalize locale during test compilation.
   set(_CheckFortranCompilerFlag_LOCALE_VARS LC_ALL LC_MESSAGES LANG)
@@ -62,5 +62,5 @@ macro (CHECK_Fortran_COMPILER_FLAG _FLAG _RESULT)
   unset(_CheckFortranCompilerFlag_LOCALE_VARS)
   unset(_CheckFortranCompilerFlag_COMMON_PATTERNS)
 
-  set (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
+  set (CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
 endmacro ()
-- 
1.9.1

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help