From a146e03422dcfaa6df6dc2f5ce594862126b17ef Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 19 Jan 2011 18:05:46 -0500 Subject: [PATCH] Fix relative CMAKE_USER_MAKE_RULES_OVERRIDE (#11725) In commit 295b5b60 (Honor CMAKE_USER_MAKE_RULES_OVERRIDE in try_compile, 2010-06-29) we started passing the value of this variable when building a try_compile project. If the variable contains a relative path it must be treated with respect to the file where it is first used. Ensure that the value is converted to a full path so that it is correctly referenced in the try_compile projects. --- Modules/CMakeCInformation.cmake | 14 +++++++++----- Modules/CMakeCXXInformation.cmake | 14 +++++++++----- Modules/CMakeFortranInformation.cmake | 14 +++++++++----- Modules/CMakeJavaInformation.cmake | 16 ++++++++++------ 4 files changed, 37 insertions(+), 21 deletions(-) diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake index fb4f0e8a3..1dc46f2c2 100644 --- a/Modules/CMakeCInformation.cmake +++ b/Modules/CMakeCInformation.cmake @@ -1,6 +1,6 @@ #============================================================================= -# Copyright 2004-2009 Kitware, Inc. +# Copyright 2004-2011 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -74,12 +74,16 @@ ENDIF (NOT _INCLUDED_FILE) # be made to those values. IF(CMAKE_USER_MAKE_RULES_OVERRIDE) - INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE}) -ENDIF(CMAKE_USER_MAKE_RULES_OVERRIDE) + # Save the full path of the file so try_compile can use it. + INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE} RESULT_VARIABLE _override) + SET(CMAKE_USER_MAKE_RULES_OVERRIDE "${_override}") +ENDIF() IF(CMAKE_USER_MAKE_RULES_OVERRIDE_C) - INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE_C}) -ENDIF(CMAKE_USER_MAKE_RULES_OVERRIDE_C) + # Save the full path of the file so try_compile can use it. + INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE_C} RESULT_VARIABLE _override) + SET(CMAKE_USER_MAKE_RULES_OVERRIDE_C "${_override}") +ENDIF() # for most systems a module is the same as a shared library diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake index 0a7e9903e..1bfcd1a86 100644 --- a/Modules/CMakeCXXInformation.cmake +++ b/Modules/CMakeCXXInformation.cmake @@ -1,6 +1,6 @@ #============================================================================= -# Copyright 2004-2009 Kitware, Inc. +# Copyright 2004-2011 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -73,12 +73,16 @@ ENDIF (NOT _INCLUDED_FILE) # be made to those values. IF(CMAKE_USER_MAKE_RULES_OVERRIDE) - INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE}) -ENDIF(CMAKE_USER_MAKE_RULES_OVERRIDE) + # Save the full path of the file so try_compile can use it. + INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE} RESULT_VARIABLE _override) + SET(CMAKE_USER_MAKE_RULES_OVERRIDE "${_override}") +ENDIF() IF(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX) - INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE_CXX}) -ENDIF(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX) + # Save the full path of the file so try_compile can use it. + INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE_CXX} RESULT_VARIABLE _override) + SET(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX "${_override}") +ENDIF() # for most systems a module is the same as a shared library diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake index 97a5e7e91..a0072f4dc 100644 --- a/Modules/CMakeFortranInformation.cmake +++ b/Modules/CMakeFortranInformation.cmake @@ -1,6 +1,6 @@ #============================================================================= -# Copyright 2004-2009 Kitware, Inc. +# Copyright 2004-2011 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -50,12 +50,16 @@ ENDIF (NOT _INCLUDED_FILE) # be made to those values. IF(CMAKE_USER_MAKE_RULES_OVERRIDE) - INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE}) -ENDIF(CMAKE_USER_MAKE_RULES_OVERRIDE) + # Save the full path of the file so try_compile can use it. + INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE} RESULT_VARIABLE _override) + SET(CMAKE_USER_MAKE_RULES_OVERRIDE "${_override}") +ENDIF() IF(CMAKE_USER_MAKE_RULES_OVERRIDE_Fortran) - INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE_Fortran}) -ENDIF(CMAKE_USER_MAKE_RULES_OVERRIDE_Fortran) + # Save the full path of the file so try_compile can use it. + INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE_Fortran} RESULT_VARIABLE _override) + SET(CMAKE_USER_MAKE_RULES_OVERRIDE_Fortran "${_override}") +ENDIF() # Fortran needs cmake to do a requires step during its build process to diff --git a/Modules/CMakeJavaInformation.cmake b/Modules/CMakeJavaInformation.cmake index f537da53d..f6503bb3e 100644 --- a/Modules/CMakeJavaInformation.cmake +++ b/Modules/CMakeJavaInformation.cmake @@ -1,6 +1,6 @@ #============================================================================= -# Copyright 2004-2009 Kitware, Inc. +# Copyright 2004-2011 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -19,12 +19,16 @@ # be made to those values. IF(CMAKE_USER_MAKE_RULES_OVERRIDE) - INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE}) -ENDIF(CMAKE_USER_MAKE_RULES_OVERRIDE) + # Save the full path of the file so try_compile can use it. + INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE} RESULT_VARIABLE _override) + SET(CMAKE_USER_MAKE_RULES_OVERRIDE "${_override}") +ENDIF() -IF(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX) - INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE_CXX}) -ENDIF(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX) +IF(CMAKE_USER_MAKE_RULES_OVERRIDE_Java) + # Save the full path of the file so try_compile can use it. + INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE_Java} RESULT_VARIABLE _override) + SET(CMAKE_USER_MAKE_RULES_OVERRIDE_Java "${_override}") +ENDIF() # this is a place holder if java needed flags for javac they would go here. IF(NOT CMAKE_Java_CREATE_STATIC_LIBRARY)