Revision: 77628
          http://sourceforge.net/p/brlcad/code/77628
Author:   starseeker
Date:     2020-10-24 02:58:15 +0000 (Sat, 24 Oct 2020)
Log Message:
-----------
Adjust CMAKE_INSTALL_PREFIX path setup, use variable for substitution key

Modified Paths:
--------------
    brlcad/branches/extbuild/CMakeLists.txt
    brlcad/branches/extbuild/misc/CMake/BRLCAD_Install_Prefix.cmake
    brlcad/branches/extbuild/misc/CMake/multiconfig_path_read.cmake.in

Modified: brlcad/branches/extbuild/CMakeLists.txt
===================================================================
--- brlcad/branches/extbuild/CMakeLists.txt     2020-10-24 02:22:56 UTC (rev 
77627)
+++ brlcad/branches/extbuild/CMakeLists.txt     2020-10-24 02:58:15 UTC (rev 
77628)
@@ -2208,7 +2208,6 @@
   endif(ALL_CMAKE_INSTALL_FILES_ORIG)
   # need a build target for this one - install directory may be dependent on 
configuration, but that won't
   # do for BRL-CAD reporting purposes - must get the fully qualified path at 
build time.
-  string(REPLACE "\${BUILD_TYPE}" "----BUILD_TYPE----" 
CMAKE_INSTALL_PREFIX_CFG "${CMAKE_INSTALL_PREFIX}")
   configure_file("${BRLCAD_CMAKE_DIR}/multiconfig_path_clean.cmake.in" 
"${CMAKE_BINARY_DIR}/CMakeTmp/multiconfig_path_clean.cmake" @ONLY)
   DISTCLEAN("${CMAKE_BINARY_DIR}/CMakeTmp/multiconfig_path_clean.cmake")
   configure_file("${BRLCAD_CMAKE_DIR}/multiconfig_path_read.cmake.in" 
"${CMAKE_BINARY_DIR}/CMakeTmp/multiconfig_path_read.cmake" @ONLY)

Modified: brlcad/branches/extbuild/misc/CMake/BRLCAD_Install_Prefix.cmake
===================================================================
--- brlcad/branches/extbuild/misc/CMake/BRLCAD_Install_Prefix.cmake     
2020-10-24 02:22:56 UTC (rev 77627)
+++ brlcad/branches/extbuild/misc/CMake/BRLCAD_Install_Prefix.cmake     
2020-10-24 02:58:15 UTC (rev 77628)
@@ -1,68 +1,8 @@
+# If we need it, use a standard string to stand in for build types.  This
+# allows for easier replacing later in the logic
+set(BUILD_TYPE_KEY "----BUILD_TYPE----")
 
 #---------------------------------------------------------------------
-# Searching the system for packages presents something of a dilemma -
-# in most situations it is Very Bad for a BRL-CAD build to be using
-# older versions of libraries in install directories as search results.
-# Generally, the desired behavior is to ignore whatever libraries are
-# in the install directories, and only use external library results if
-# they are something already found on the system due to non-BRL-CAD
-# installation (source compile, package managers, etc.).  Unfortunately,
-# CMake's standard behavior is to add CMAKE_INSTALL_PREFIX to the search
-# path once defined, resulting in (for us) the unexpected behavior of
-# returning old installed libraries when CMake is re-run in a directory.
-#
-# To work around this, there are two possible approaches.  One,
-# identified by Maik Beckmann, operates on CMAKE_SYSTEM_PREFIX_PATH:
-#
-# http://www.cmake.org/pipermail/cmake/2010-October/040292.html
-#
-# The other, pointed out by Michael Hertling, uses the
-# CMake_[SYSTEM_]IGNORE_PATH variables.
-#
-# http://www.cmake.org/pipermail/cmake/2011-May/044503.html
-#
-# BRL-CAD initially operated on CMAKE_SYSTEM_PREFIX_PATH, but has
-# switched to using the *_IGNORE_PATH variables.  This requires
-# CMake 2.8.3 or later.
-#
-# The complication with ignoring install paths is if we are
-# installing to a "legitimate" system search path - i.e. our
-# CMAKE_INSTALL_PREFIX value is standard enough that it is a legitimate
-# search target for find_package. In this case, we can't exclude
-# accidental hits on our libraries without also excluding legitimate
-# find_package results.  So the net results are:
-#
-# 1.  If you are planning to install to a system directory (typically
-#     a bad idea but the settings are legal) clean out the old system
-#     first or accept that the old libraries will be found and used.
-#
-# 2.  For more custom paths, the logic below will avoid the value
-#     of CMAKE_INSTALL_PREFIX in find_package searches
-#
-# (Note:  CMAKE_INSTALL_PREFIX must be checked in the case where someone
-# sets it on the command line prior to CMake being run.  BRLCAD_PREFIX
-# preserves the CMAKE_INSTALL_PREFIX setting from the previous CMake run.
-# CMAKE_INSTALL_PREFIX does not seem to be immediately set in this context
-# when CMake is re-run unless specified explicitly on the command line.
-# To ensure the previous (and internally set) CMAKE_INSTALL_PREFIX value
-# is available, BRLCAD_PREFIX is used to store the value in the cache.)
-
-if(CMAKE_INSTALL_PREFIX)
-  if(NOT "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr" AND NOT 
"${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr/local")
-    get_filename_component(PATH_NORMALIZED 
"${CMAKE_INSTALL_PREFIX}/${LIB_DIR}" ABSOLUTE)
-    set(CMAKE_SYSTEM_IGNORE_PATH "${PATH_NORMALIZED}")
-  endif(NOT "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr" AND NOT 
"${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr/local")
-endif(CMAKE_INSTALL_PREFIX)
-if(BRLCAD_PREFIX)
-  if(NOT "${BRLCAD_PREFIX}" STREQUAL "/usr" AND NOT "${BRLCAD_PREFIX}" 
STREQUAL "/usr/local")
-    get_filename_component(PATH_NORMALIZED "${BRLCAD_PREFIX}/${LIB_DIR}" 
ABSOLUTE)
-    set(CMAKE_SYSTEM_IGNORE_PATH "${PATH_NORMALIZED}")
-  endif(NOT "${BRLCAD_PREFIX}" STREQUAL "/usr" AND NOT "${BRLCAD_PREFIX}" 
STREQUAL "/usr/local")
-endif(BRLCAD_PREFIX)
-mark_as_advanced(CMAKE_SYSTEM_IGNORE_PATH)
-
-
-#---------------------------------------------------------------------
 # The location in which to install BRL-CAD.  Only do this if
 # CMAKE_INSTALL_PREFIX hasn't been set already, to try and allow
 # parent builds (if any) some control.
@@ -111,7 +51,7 @@
                                set(CMAKE_INSTALL_PREFIX "C:/Program Files 
(x86)/BRL-CAD ${BRLCAD_VERSION}")
                        endif(CMAKE_CL_64)
                else(MSVC)
-                       set(CMAKE_INSTALL_PREFIX 
"/usr/brlcad/----BUILD_TYPE-----${BRLCAD_VERSION}")
+                       set(CMAKE_INSTALL_PREFIX 
"/usr/brlcad/${BUILD_TYPE_KEY}-${BRLCAD_VERSION}")
                endif(MSVC)
        endif(NOT CMAKE_CONFIGURATION_TYPES)
        set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE PATH "BRL-CAD 
install prefix" FORCE)
@@ -143,6 +83,74 @@
   message(FATAL_ERROR "If you wish to proceed using /usr as your prefix, 
define BRLCAD_ALLOW_INSTALL_TO_USR=1 for CMake")
 endif("${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr" AND NOT 
BRLCAD_ALLOW_INSTALL_TO_USR)
 
+#---------------------------------------------------------------------
+# Searching the system for packages presents something of a dilemma -
+# in most situations it is Very Bad for a BRL-CAD build to be using
+# older versions of libraries in install directories as search results.
+# Generally, the desired behavior is to ignore whatever libraries are
+# in the install directories, and only use external library results if
+# they are something already found on the system due to non-BRL-CAD
+# installation (source compile, package managers, etc.).  Unfortunately,
+# CMake's standard behavior is to add CMAKE_INSTALL_PREFIX to the search
+# path once defined, resulting in (for us) the unexpected behavior of
+# returning old installed libraries when CMake is re-run in a directory.
+#
+# To work around this, there are two possible approaches.  One,
+# identified by Maik Beckmann, operates on CMAKE_SYSTEM_PREFIX_PATH:
+#
+# http://www.cmake.org/pipermail/cmake/2010-October/040292.html
+#
+# The other, pointed out by Michael Hertling, uses the
+# CMake_[SYSTEM_]IGNORE_PATH variables.
+#
+# http://www.cmake.org/pipermail/cmake/2011-May/044503.html
+#
+# BRL-CAD initially operated on CMAKE_SYSTEM_PREFIX_PATH, but has
+# switched to using the *_IGNORE_PATH variables.  This requires
+# CMake 2.8.3 or later.
+#
+# The complication with ignoring install paths is if we are
+# installing to a "legitimate" system search path - i.e. our
+# CMAKE_INSTALL_PREFIX value is standard enough that it is a legitimate
+# search target for find_package. In this case, we can't exclude
+# accidental hits on our libraries without also excluding legitimate
+# find_package results.  So the net results are:
+#
+# 1.  If you are planning to install to a system directory (typically
+#     a bad idea but the settings are legal) clean out the old system
+#     first or accept that the old libraries will be found and used.
+#
+# 2.  For more custom paths, the logic below will avoid the value
+#     of CMAKE_INSTALL_PREFIX in find_package searches
+#
+# (Note:  CMAKE_INSTALL_PREFIX must be checked in the case where someone
+# sets it on the command line prior to CMake being run.  BRLCAD_PREFIX
+# preserves the CMAKE_INSTALL_PREFIX setting from the previous CMake run.
+# CMAKE_INSTALL_PREFIX does not seem to be immediately set in this context
+# when CMake is re-run unless specified explicitly on the command line.
+# To ensure the previous (and internally set) CMAKE_INSTALL_PREFIX value
+# is available, BRLCAD_PREFIX is used to store the value in the cache.)
+
+if(NOT "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr" AND NOT 
"${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr/local")
+       get_filename_component(PATH_NORMALIZED 
"${CMAKE_INSTALL_PREFIX}/${LIB_DIR}" ABSOLUTE)
+       if (CMAKE_CONFIGURATION_TYPES)
+               foreach(cfg ${CMAKE_CONFIGURATION_TYPES})
+                       if ("${cfg}" STREQUAL "Release")
+                               string(REPLACE "${BUILD_TYPE_KEY}" "rel" 
"${CMAKE_INSTALL_PREFIX}" RELPATH)
+                               set(CMAKE_SYSTEM_IGNORE_PATH 
"${CMAKE_SYSTEM_IGNORE_PATH};${RELPATH}")
+                       endif ("${cfg}" STREQUAL "Release")
+                       if ("${cfg}" STREQUAL "Debug")
+                               string(REPLACE "${BUILD_TYPE_KEY}" "dev" 
"${CMAKE_INSTALL_PREFIX}" DEVPATH)
+                               set(CMAKE_SYSTEM_IGNORE_PATH 
"${CMAKE_SYSTEM_IGNORE_PATH};${DEVPATH}")
+                       endif ("${cfg}" STREQUAL "Debug")
+                       string(REPLACE "${BUILD_TYPE_KEY}" "${cfg}" 
"${CMAKE_INSTALL_PREFIX}" TYPEPATH)
+                       set(CMAKE_SYSTEM_IGNORE_PATH 
"${CMAKE_SYSTEM_IGNORE_PATH};${TYPEPATH}")
+               endforeach(cfg ${CMAKE_CONFIGURATION_TYPES})
+       else (CMAKE_CONFIGURATION_TYPES)
+               set(CMAKE_SYSTEM_IGNORE_PATH "${PATH_NORMALIZED}")
+       endif (CMAKE_CONFIGURATION_TYPES)
+endif(NOT "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr" AND NOT 
"${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr/local")
+
 #------------------------------------------------------------------------------
 # Now that we know the install prefix, generate the binary for calculating
 # and reporting time deltas

Modified: brlcad/branches/extbuild/misc/CMake/multiconfig_path_read.cmake.in
===================================================================
--- brlcad/branches/extbuild/misc/CMake/multiconfig_path_read.cmake.in  
2020-10-24 02:22:56 UTC (rev 77627)
+++ brlcad/branches/extbuild/misc/CMake/multiconfig_path_read.cmake.in  
2020-10-24 02:58:15 UTC (rev 77628)
@@ -78,7 +78,7 @@
   string(REPLACE "$<CONFIG>" "${BUILD_TYPE}" INSTALL_CONTENTS 
"${INSTALL_CONTENTS}")
   string(REPLACE "\${CONFIGURATION}/" "${BUILD_TYPE}/" INSTALL_CONTENTS 
"${INSTALL_CONTENTS}")
   string(REPLACE "\${CONFIGURATION}" "${BUILD_TYPE}" INSTALL_CONTENTS 
"${INSTALL_CONTENTS}")
-  string(REPLACE "----BUILD_TYPE----" "${BUILD_TYPE_NEW}" INSTALL_CONTENTS 
"${INSTALL_CONTENTS}")
+  string(REPLACE "@BUILD_TYPE_KEY@" "${BUILD_TYPE_NEW}" INSTALL_CONTENTS 
"${INSTALL_CONTENTS}")
   file(WRITE "${cmake_install_file}" "${INSTALL_CONTENTS}\n")
 
 endforeach(cmake_install_file ${ALL_CMAKE_INSTALL_FILES})

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to