Revision: 77828
          http://sourceforge.net/p/brlcad/code/77828
Author:   starseeker
Date:     2020-11-30 14:24:14 +0000 (Mon, 30 Nov 2020)
Log Message:
-----------
Ignore specific directories, not just the root dir of the install.  Per CMake 
docs, that actually won't work - the ignore vars ignore exact dirs, not subdirs 
in a prefix dir.  (A bit unfortunate, in some ways, since ignoring the subtree 
is really our intent here, but as far as I know CMake doesn't offer such a 
mechanism.

Modified Paths:
--------------
    brlcad/branches/extbuild/misc/CMake/BRLCAD_Install_Prefix.cmake

Modified: brlcad/branches/extbuild/misc/CMake/BRLCAD_Install_Prefix.cmake
===================================================================
--- brlcad/branches/extbuild/misc/CMake/BRLCAD_Install_Prefix.cmake     
2020-11-30 13:35:59 UTC (rev 77827)
+++ brlcad/branches/extbuild/misc/CMake/BRLCAD_Install_Prefix.cmake     
2020-11-30 14:24:14 UTC (rev 77828)
@@ -131,35 +131,38 @@
 # To ensure the previous (and internally set) CMAKE_INSTALL_PREFIX value
 # is available, BRLCAD_PREFIX is used to store the value in the cache.)
 
-# TODO - CMAKE_IGNORE_PATH needs a list of explicit directories, not a
-# list of prefixes - in other words, it ignores EXACTLY the specfied
-# path and not any subdirectories under that path.  We need to use
-# file(GLOB_RECURSE) to check CMAKE_INSTALL_PREFIX for any directories
-# under it, once we've ruled out the standard system directories, and
-# pass the full list in to CMAKE_IGNORE_PATH.  See:
+# CMAKE_IGNORE_PATH needs a list of explicit directories, not a
+# list of prefixes - in other words, it ignores EXACTLY the specified
+# path and not any subdirectories under that path.  See:
 # https://cmake.org/cmake/help/latest/variable/CMAKE_IGNORE_PATH.html
+# This means we can't just add the install path to the ignore variables
+# and have find_package skip items in the bin and lib subdirs - we need
+# to list them explicitly for exclusion.
 
 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)
+       # Make sure we are working with the fully normalized path
+       get_filename_component(PATH_NORMALIZED "${CMAKE_INSTALL_PREFIX}" 
ABSOLUTE)
+       set(IGNORE_SUBDIRS ${BIN_DIR} ${LIB_DIR})
        if (CMAKE_CONFIGURATION_TYPES)
+               # If we're doing multi-config, ignore all the possible output 
locations
                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}")
-                               set(CMAKE_IGNORE_PATH 
"${CMAKE_SYSTEM_IGNORE_PATH};${RELPATH}")
+                               string(REPLACE "${BUILD_TYPE_KEY}" "rel" 
"${CMAKE_INSTALL_PREFIX}" TYPEPATH)
+                       elseif ("${cfg}" STREQUAL "Debug")
+                               string(REPLACE "${BUILD_TYPE_KEY}" "dev" 
"${CMAKE_INSTALL_PREFIX}" TYPEPATH)
+                       else ("${cfg}" STREQUAL "Release")
+                               string(REPLACE "${BUILD_TYPE_KEY}" "${cfg}" 
"${CMAKE_INSTALL_PREFIX}" TYPEPATH)
                        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}")
-                               set(CMAKE_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}")
-                       set(CMAKE_IGNORE_PATH 
"${CMAKE_SYSTEM_IGNORE_PATH};${TYPEPATH}")
+                       foreach(sd ${IGNORE_SUBDIRS})
+                               set(CMAKE_SYSTEM_IGNORE_PATH 
"${CMAKE_SYSTEM_IGNORE_PATH};${TYPEPATH}/${sd}")
+                               set(CMAKE_IGNORE_PATH 
"${CMAKE_SYSTEM_IGNORE_PATH};${TYPEPATH}/${sd}")
+                       endforeach(sd ${IGNORE_SUBDIRS})
                endforeach(cfg ${CMAKE_CONFIGURATION_TYPES})
        else (CMAKE_CONFIGURATION_TYPES)
-               set(CMAKE_SYSTEM_IGNORE_PATH "${PATH_NORMALIZED}")
-               set(CMAKE_IGNORE_PATH "${PATH_NORMALIZED}")
+               foreach(sd ${IGNORE_SUBDIRS})
+                       set(CMAKE_SYSTEM_IGNORE_PATH 
"${CMAKE_SYSTEM_IGNORE_PATH};${PATH_NORMALIZED}/${sd}")
+                       set(CMAKE_IGNORE_PATH 
"${CMAKE_SYSTEM_IGNORE_PATH};${PATH_NORMALIZED}/${sd}")
+               endforeach(sd ${IGNORE_SUBDIRS})
        endif (CMAKE_CONFIGURATION_TYPES)
 endif(NOT "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr" AND NOT 
"${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr/local")
 

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