Revision: 77892
          http://sourceforge.net/p/brlcad/code/77892
Author:   starseeker
Date:     2020-12-03 15:59:46 +0000 (Thu, 03 Dec 2020)
Log Message:
-----------
Fix environment setup, break out install prefix management.

Modified Paths:
--------------
    brlcad/trunk/CMakeLists.txt
    brlcad/trunk/misc/CMake/BRLCAD_Environment_Setup.cmake
    brlcad/trunk/misc/CMake/CMakeLists.txt

Added Paths:
-----------
    brlcad/trunk/misc/CMake/BRLCAD_Install_Prefix.cmake

Modified: brlcad/trunk/CMakeLists.txt
===================================================================
--- brlcad/trunk/CMakeLists.txt 2020-12-03 15:45:27 UTC (rev 77891)
+++ brlcad/trunk/CMakeLists.txt 2020-12-03 15:59:46 UTC (rev 77892)
@@ -179,69 +179,6 @@
 endif (NOT BRLCAD_IS_SUBBUILD)
 
 #---------------------------------------------------------------------
-# 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)
-
-#---------------------------------------------------------------------
 # Set up include paths for generated header files.  For multi-config
 # builds, make sure we get build-specific dirs.
 if(CMAKE_CONFIGURATION_TYPES)
@@ -499,68 +436,12 @@
 endif (IS_DIRECTORY /usr/local)
 
 #---------------------------------------------------------------------
-# 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.
+# Intricacies involved with setting the install path mostly revolve
+# around build type dependent install directories.  Also needs the
+# current version defined.
 
-# TODO - explore use the CONFIGURATIONS
-# option in our macros and the ExternalProject_Add management:
-# https://cmake.org/cmake/help/latest/command/install.html
-#
-if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR NOT CMAKE_INSTALL_PREFIX)
-  if(NOT CMAKE_CONFIGURATION_TYPES)
-    if("${CMAKE_BUILD_TYPE}" MATCHES "Release")
-      set(CMAKE_INSTALL_PREFIX "/usr/brlcad/rel-${BRLCAD_VERSION}")
-    else("${CMAKE_BUILD_TYPE}" MATCHES "Release")
-      set(CMAKE_INSTALL_PREFIX "/usr/brlcad/dev-${BRLCAD_VERSION}")
-    endif("${CMAKE_BUILD_TYPE}" MATCHES "Release")
-  else(NOT CMAKE_CONFIGURATION_TYPES)
-    if(MSVC)
-      if(CMAKE_CL_64)
-       set(CMAKE_INSTALL_PREFIX "C:/Program Files/BRL-CAD ${BRLCAD_VERSION}")
-      else(CMAKE_CL_64)
-       set(CMAKE_INSTALL_PREFIX "C:/Program Files (x86)/BRL-CAD 
${BRLCAD_VERSION}")
-      endif(CMAKE_CL_64)
-    else(MSVC)
-      set(CMAKE_INSTALL_PREFIX "/usr/brlcad/dev-${BRLCAD_VERSION}")
-    endif(MSVC)
-  endif(NOT CMAKE_CONFIGURATION_TYPES)
-  set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE PATH "BRL-CAD install 
prefix" FORCE)
-  set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT 0)
-endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR NOT CMAKE_INSTALL_PREFIX)
-set(BRLCAD_PREFIX "${CMAKE_INSTALL_PREFIX}" CACHE STRING "BRL-CAD install 
prefix")
-mark_as_advanced(BRLCAD_PREFIX)
-if (DEFINED CMAKE_INSTALL_PREFIX AND NOT DEFINED CMAKE_INSTALL_PREFIX)
-  set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
-endif (DEFINED CMAKE_INSTALL_PREFIX AND NOT DEFINED CMAKE_INSTALL_PREFIX)
+include(BRLCAD_Install_Prefix)
 
-
-# If we've a Release build with a Debug path or vice versa, warn about
-# it.  A "make install" of a Release build into a dev install
-# directory or vice versa is going to result in an install that
-# doesn't respect BRL-CAD standard naming conventions.
-if("${CMAKE_BUILD_TYPE}" MATCHES "Release" AND "${CMAKE_INSTALL_PREFIX}" 
STREQUAL "/usr/brlcad/dev-${BRLCAD_VERSION}")
-  message(FATAL_ERROR "\nInstallation directory (CMAKE_INSTALL_PREFIX) is set 
to /usr/brlcad/dev-${BRLCAD_VERSION}, but build type is set to Release!\n")
-endif("${CMAKE_BUILD_TYPE}" MATCHES "Release" AND "${CMAKE_INSTALL_PREFIX}" 
STREQUAL "/usr/brlcad/dev-${BRLCAD_VERSION}")
-if("${CMAKE_BUILD_TYPE}" MATCHES "Debug" AND "${CMAKE_INSTALL_PREFIX}" 
STREQUAL "/usr/brlcad/rel-${BRLCAD_VERSION}")
-  message(FATAL_ERROR "\nInstallation directory (CMAKE_INSTALL_PREFIX) is set 
to /usr/brlcad/rel-${BRLCAD_VERSION}, but build type is set to Debug!\n")
-endif("${CMAKE_BUILD_TYPE}" MATCHES "Debug" AND "${CMAKE_INSTALL_PREFIX}" 
STREQUAL "/usr/brlcad/rel-${BRLCAD_VERSION}")
-
-# If CMAKE_INSTALL_PREFIX is "/usr", be VERY noisy about it - a make install in
-# this location is dangerous/destructive on some systems.
-if("${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr" AND NOT 
BRLCAD_ALLOW_INSTALL_TO_USR)
-  message(WARNING "}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}\nIt is 
STRONGLY recommended that you DO NOT install BRL-CAD into /usr as BRL-CAD 
provides several libraries that may conflict with other libraries (e.g. librt, 
libbu, libbn) on certain system configurations.\nSince our libraries predate 
all those that we're known to conflict with and are at the very core of our 
geometry services and project heritage, we have no plans to change the names of 
our libraries at this time.\nINSTALLING INTO /usr CAN MAKE A SYSTEM COMPLETELY 
UNUSABLE.  If you choose to continue installing into /usr, you do so entirely 
at your own risk.  You have been 
warned.\n}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}")
-  if(SLEEP_EXEC)
-    execute_process(COMMAND ${SLEEP_EXEC} 15)
-  endif(SLEEP_EXEC)
-  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)
-
-#------------------------------------------------------------------------------
-# Now that we know the install prefix, generate the binary for calculating
-# and reporting time deltas
-generate_dreport()
-
 #---------------------------------------------------------------------
 # The following logic is what allows binaries to run successfully in
 # the build directory AND install directory.  Thanks to plplot for
@@ -733,7 +614,20 @@
   CONFIG_H_APPEND(BRLCAD "#define NDEBUG 1\n")
 endif(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" AND NOT 
CMAKE_CONFIGURATION_TYPES)
 
+#----------------------------------------------------------------------
+# Let config.h know whether we're doing a 32 or a 64 bit build.
 
+CONFIG_H_APPEND(BRLCAD "#define SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P}\n")
+
+# OpenBSD doesn't define __WORD_SIZE
+if(${CMAKE_WORD_SIZE} MATCHES "32BIT")
+  CONFIG_H_APPEND(BRLCAD "#ifndef __WORDSIZE\n#  define __WORDSIZE 
32\n#endif\n")
+endif(${CMAKE_WORD_SIZE} MATCHES "32BIT")
+if(${CMAKE_WORD_SIZE} MATCHES "64BIT")
+  CONFIG_H_APPEND(BRLCAD "#ifndef __WORDSIZE\n#  define __WORDSIZE 
64\n#endif\n")
+endif(${CMAKE_WORD_SIZE} MATCHES "64BIT")
+
+#----------------------------------------------------------------------
 # Auto-reconfiguration - by default, a CMake generated build system
 # will re-run CMake if it detects that build system logic has changed.
 # This is normally a good thing, but becomes problematic when using

Modified: brlcad/trunk/misc/CMake/BRLCAD_Environment_Setup.cmake
===================================================================
--- brlcad/trunk/misc/CMake/BRLCAD_Environment_Setup.cmake      2020-12-03 
15:45:27 UTC (rev 77891)
+++ brlcad/trunk/misc/CMake/BRLCAD_Environment_Setup.cmake      2020-12-03 
15:59:46 UTC (rev 77892)
@@ -1,3 +1,5 @@
+# Setup and checks related to system environment settings
+
 #---------------------------------------------------------------------
 # Save the current LC_ALL, LC_MESSAGES, and LANG environment variables
 # and set them to "C" so things like date output are as expected.
@@ -73,7 +75,7 @@
   endif(SLEEP_EXEC)
 endif(NOT "$ENV{BRLCAD_ROOT}" STREQUAL "" AND NOT BRLCAD_ROOT_OVERRIDE)
 
-#----------------------------------------------------------------------
+#---------------------------------------------------------------------
 # Characterize the system as 32 or 64 bit - this has an impact on many
 # of the subsequent operations, including find_package results, so it
 # must be done up front.
@@ -92,7 +94,8 @@
 mark_as_advanced(BRLCAD_WORD_SIZE)
 
 # calculate the size of a pointer if we haven't already
-CHECK_TYPE_SIZE("void *" CMAKE_SIZEOF_VOID_P)
+include(CheckTypeSize)
+check_type_size("void *" CMAKE_SIZEOF_VOID_P)
 
 # still not defined?
 if(NOT CMAKE_SIZEOF_VOID_P)
@@ -110,11 +113,11 @@
       set(BRLCAD_WORD_SIZE "32BIT (AUTO)" CACHE STRING WORD_SIZE_LABEL FORCE)
     else(${CMAKE_SIZEOF_VOID_P} MATCHES "^4$")
       if(${CMAKE_SIZEOF_VOID_P} MATCHES "^2$")
-       set(CMAKE_WORD_SIZE "16BIT")
-       set(BRLCAD_WORD_SIZE "16BIT (AUTO)" CACHE STRING WORD_SIZE_LABEL FORCE)
+        set(CMAKE_WORD_SIZE "16BIT")
+        set(BRLCAD_WORD_SIZE "16BIT (AUTO)" CACHE STRING WORD_SIZE_LABEL FORCE)
       else(${CMAKE_SIZEOF_VOID_P} MATCHES "^2$")
-       set(CMAKE_WORD_SIZE "8BIT")
-       set(BRLCAD_WORD_SIZE "8BIT (AUTO)" CACHE STRING WORD_SIZE_LABEL FORCE)
+        set(CMAKE_WORD_SIZE "8BIT")
+        set(BRLCAD_WORD_SIZE "8BIT (AUTO)" CACHE STRING WORD_SIZE_LABEL FORCE)
       endif(${CMAKE_SIZEOF_VOID_P} MATCHES "^2$")
     endif(${CMAKE_SIZEOF_VOID_P} MATCHES "^4$")
   endif(${CMAKE_SIZEOF_VOID_P} MATCHES "^8$")
@@ -130,8 +133,8 @@
     if(NOT ${CMAKE_WORD_SIZE} MATCHES "64BIT")
       set(CMAKE_WORD_SIZE "64BIT")
       if(NOT "${BRLCAD_WORD_SIZE}" MATCHES "AUTO")
-       message(WARNING "Selected MSVC compiler is 64BIT - setting word size to 
64BIT.  To perform a 32BIT MSVC build, select the 32BIT MSVC CMake generator.")
-       set(BRLCAD_WORD_SIZE "64BIT" CACHE STRING WORD_SIZE_LABEL FORCE)
+        message(WARNING "Selected MSVC compiler is 64BIT - setting word size 
to 64BIT.  To perform a 32BIT MSVC build, select the 32BIT MSVC CMake 
generator.")
+        set(BRLCAD_WORD_SIZE "64BIT" CACHE STRING WORD_SIZE_LABEL FORCE)
       endif(NOT "${BRLCAD_WORD_SIZE}" MATCHES "AUTO")
     endif(NOT ${CMAKE_WORD_SIZE} MATCHES "64BIT")
     add_definitions("-D_WIN64")
@@ -140,8 +143,8 @@
     if(NOT ${CMAKE_WORD_SIZE} MATCHES "32BIT")
       set(CMAKE_WORD_SIZE "32BIT")
       if(NOT "${BRLCAD_WORD_SIZE}" MATCHES "AUTO")
-       message(WARNING "Selected MSVC compiler is 32BIT - setting word size to 
32BIT.  To perform a 64BIT MSVC build, select the 64BIT MSVC CMake generator.")
-       set(BRLCAD_WORD_SIZE "32BIT" CACHE STRING WORD_SIZE_LABEL FORCE)
+        message(WARNING "Selected MSVC compiler is 32BIT - setting word size 
to 32BIT.  To perform a 64BIT MSVC build, select the 64BIT MSVC CMake 
generator.")
+        set(BRLCAD_WORD_SIZE "32BIT" CACHE STRING WORD_SIZE_LABEL FORCE)
       endif(NOT "${BRLCAD_WORD_SIZE}" MATCHES "AUTO")
     endif(NOT ${CMAKE_WORD_SIZE} MATCHES "32BIT")
   endif(CMAKE_CL_64)
@@ -149,19 +152,9 @@
 
 # If a platform specific variable needs to be set for 32 bit, do it here
 if (${CMAKE_WORD_SIZE} MATCHES "32BIT")
-  set(CMAKE_OSX_ARCHITECTURES "i386" CACHE STRING "Building for i386" FORCE)
+       set(CMAKE_OSX_ARCHITECTURES "i386" CACHE STRING "Building for i386" 
FORCE)
 endif (${CMAKE_WORD_SIZE} MATCHES "32BIT")
 
-CONFIG_H_APPEND(BRLCAD "#define SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P}\n")
-
-# OpenBSD doesn't define __WORD_SIZE
-if(${CMAKE_WORD_SIZE} MATCHES "32BIT")
-  CONFIG_H_APPEND(BRLCAD "#ifndef __WORDSIZE\n#  define __WORDSIZE 
32\n#endif\n")
-endif(${CMAKE_WORD_SIZE} MATCHES "32BIT")
-if(${CMAKE_WORD_SIZE} MATCHES "64BIT")
-  CONFIG_H_APPEND(BRLCAD "#ifndef __WORDSIZE\n#  define __WORDSIZE 
64\n#endif\n")
-endif(${CMAKE_WORD_SIZE} MATCHES "64BIT")
-
 # Based on what we are doing, we may need to constrain our search paths
 #
 # NOTE: Ideally we would set a matching property for 32 bit paths

Added: brlcad/trunk/misc/CMake/BRLCAD_Install_Prefix.cmake
===================================================================
--- brlcad/trunk/misc/CMake/BRLCAD_Install_Prefix.cmake                         
(rev 0)
+++ brlcad/trunk/misc/CMake/BRLCAD_Install_Prefix.cmake 2020-12-03 15:59:46 UTC 
(rev 77892)
@@ -0,0 +1,126 @@
+#---------------------------------------------------------------------
+# 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.
+
+# TODO - explore use the CONFIGURATIONS
+# option in our macros and the ExternalProject_Add management:
+# https://cmake.org/cmake/help/latest/command/install.html
+#
+if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR NOT CMAKE_INSTALL_PREFIX)
+  if(NOT CMAKE_CONFIGURATION_TYPES)
+    if("${CMAKE_BUILD_TYPE}" MATCHES "Release")
+      set(CMAKE_INSTALL_PREFIX "/usr/brlcad/rel-${BRLCAD_VERSION}")
+    else("${CMAKE_BUILD_TYPE}" MATCHES "Release")
+      set(CMAKE_INSTALL_PREFIX "/usr/brlcad/dev-${BRLCAD_VERSION}")
+    endif("${CMAKE_BUILD_TYPE}" MATCHES "Release")
+  else(NOT CMAKE_CONFIGURATION_TYPES)
+    if(MSVC)
+      if(CMAKE_CL_64)
+       set(CMAKE_INSTALL_PREFIX "C:/Program Files/BRL-CAD ${BRLCAD_VERSION}")
+      else(CMAKE_CL_64)
+       set(CMAKE_INSTALL_PREFIX "C:/Program Files (x86)/BRL-CAD 
${BRLCAD_VERSION}")
+      endif(CMAKE_CL_64)
+    else(MSVC)
+      set(CMAKE_INSTALL_PREFIX "/usr/brlcad/dev-${BRLCAD_VERSION}")
+    endif(MSVC)
+  endif(NOT CMAKE_CONFIGURATION_TYPES)
+  set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE PATH "BRL-CAD install 
prefix" FORCE)
+  set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT 0)
+endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR NOT CMAKE_INSTALL_PREFIX)
+set(BRLCAD_PREFIX "${CMAKE_INSTALL_PREFIX}" CACHE STRING "BRL-CAD install 
prefix")
+mark_as_advanced(BRLCAD_PREFIX)
+if (DEFINED CMAKE_INSTALL_PREFIX AND NOT DEFINED CMAKE_INSTALL_PREFIX)
+  set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
+endif (DEFINED CMAKE_INSTALL_PREFIX AND NOT DEFINED CMAKE_INSTALL_PREFIX)
+
+# If we've a Release build with a Debug path or vice versa, warn about
+# it.  A "make install" of a Release build into a dev install
+# directory or vice versa is going to result in an install that
+# doesn't respect BRL-CAD standard naming conventions.
+if("${CMAKE_BUILD_TYPE}" MATCHES "Release" AND "${CMAKE_INSTALL_PREFIX}" 
STREQUAL "/usr/brlcad/dev-${BRLCAD_VERSION}")
+  message(FATAL_ERROR "\nInstallation directory (CMAKE_INSTALL_PREFIX) is set 
to /usr/brlcad/dev-${BRLCAD_VERSION}, but build type is set to Release!\n")
+endif("${CMAKE_BUILD_TYPE}" MATCHES "Release" AND "${CMAKE_INSTALL_PREFIX}" 
STREQUAL "/usr/brlcad/dev-${BRLCAD_VERSION}")
+if("${CMAKE_BUILD_TYPE}" MATCHES "Debug" AND "${CMAKE_INSTALL_PREFIX}" 
STREQUAL "/usr/brlcad/rel-${BRLCAD_VERSION}")
+  message(FATAL_ERROR "\nInstallation directory (CMAKE_INSTALL_PREFIX) is set 
to /usr/brlcad/rel-${BRLCAD_VERSION}, but build type is set to Debug!\n")
+endif("${CMAKE_BUILD_TYPE}" MATCHES "Debug" AND "${CMAKE_INSTALL_PREFIX}" 
STREQUAL "/usr/brlcad/rel-${BRLCAD_VERSION}")
+
+#------------------------------------------------------------------------------
+# If CMAKE_INSTALL_PREFIX is "/usr", be VERY noisy about it - a make install in
+# this location is dangerous/destructive on some systems.
+if("${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr" AND NOT 
BRLCAD_ALLOW_INSTALL_TO_USR)
+  message(WARNING "}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}\nIt is 
STRONGLY recommended that you DO NOT install BRL-CAD into /usr as BRL-CAD 
provides several libraries that may conflict with other libraries (e.g. librt, 
libbu, libbn) on certain system configurations.\nSince our libraries predate 
all those that we're known to conflict with and are at the very core of our 
geometry services and project heritage, we have no plans to change the names of 
our libraries at this time.\nINSTALLING INTO /usr CAN MAKE A SYSTEM COMPLETELY 
UNUSABLE.  If you choose to continue installing into /usr, you do so entirely 
at your own risk.  You have been 
warned.\n}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}")
+  if(SLEEP_EXEC)
+    execute_process(COMMAND ${SLEEP_EXEC} 15)
+  endif(SLEEP_EXEC)
+  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(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)
+
+#------------------------------------------------------------------------------
+# Now that we know the install prefix, generate the binary for calculating
+# and reporting time deltas
+generate_dreport()
+


Property changes on: brlcad/trunk/misc/CMake/BRLCAD_Install_Prefix.cmake
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: brlcad/trunk/misc/CMake/CMakeLists.txt
===================================================================
--- brlcad/trunk/misc/CMake/CMakeLists.txt      2020-12-03 15:45:27 UTC (rev 
77891)
+++ brlcad/trunk/misc/CMake/CMakeLists.txt      2020-12-03 15:59:46 UTC (rev 
77892)
@@ -4,6 +4,7 @@
   BRLCAD_CPackOptions.cmake.in
   BRLCAD_CheckFunctions.cmake
   BRLCAD_Environment_Setup.cmake
+  BRLCAD_Install_Prefix.cmake
   BRLCAD_Options.cmake
   BRLCAD_Regress_Util.cmake
   BRLCAD_Summary.cmake

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