Revision: 77914
          http://sourceforge.net/p/brlcad/code/77914
Author:   starseeker
Date:     2020-12-04 00:33:50 +0000 (Fri, 04 Dec 2020)
Log Message:
-----------
Adjust how we are updating the install path for the dev and rel paths.  With 
Ninja MultiConfig on Windows, the old approach was inadequate.

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

Modified: brlcad/trunk/CMakeLists.txt
===================================================================
--- brlcad/trunk/CMakeLists.txt 2020-12-03 20:14:35 UTC (rev 77913)
+++ brlcad/trunk/CMakeLists.txt 2020-12-04 00:33:50 UTC (rev 77914)
@@ -2174,7 +2174,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/trunk/misc/CMake/BRLCAD_Install_Prefix.cmake
===================================================================
--- brlcad/trunk/misc/CMake/BRLCAD_Install_Prefix.cmake 2020-12-03 20:14:35 UTC 
(rev 77913)
+++ brlcad/trunk/misc/CMake/BRLCAD_Install_Prefix.cmake 2020-12-04 00:33:50 UTC 
(rev 77914)
@@ -33,6 +33,10 @@
 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
 ###
+# 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----")
+
 #---------------------------------------------------------------------
 # The location in which to install BRL-CAD.  Only do this if
 # CMAKE_INSTALL_PREFIX hasn't been set already, to try and allow
@@ -57,7 +61,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/dev-${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)

Modified: brlcad/trunk/misc/CMake/multiconfig_path_read.cmake.in
===================================================================
--- brlcad/trunk/misc/CMake/multiconfig_path_read.cmake.in      2020-12-03 
20:14:35 UTC (rev 77913)
+++ brlcad/trunk/misc/CMake/multiconfig_path_read.cmake.in      2020-12-04 
00:33:50 UTC (rev 77914)
@@ -52,39 +52,37 @@
   set(BUILD_TYPE_NEW "${BUILD_TYPE}")
 endif(NOT BUILD_TYPE_NEW)
 
-# The installation directory is compiled in, so to that extent at least a 
build time configuration
-# change that results in a different installation path requires a re-compile.  
Write to a temp file
-# to allow the build target to avoid changing the PATH file unless there is an 
actual path change -
-# this minimizes recompilation based on PATH to actual installation path 
changes, rather than
-# just configuration changes - if CMAKE_INSTALL_PREFIX is not defined based on 
the build configuration,
-# PATH is constant.
-string(REPLACE "----BUILD_TYPE----" "${BUILD_TYPE_NEW}" 
CMAKE_INSTALL_PREFIX_CFG "@CMAKE_INSTALL_PREFIX_CFG@")
-
 # We have no way to tell the build tool at build time what string we want
 # it to use for the installation path - it only knows its build configuration
 # type.  Hence, we update the cmake_install.cmake files to let them know
-# directly.  Only do this if we need to - i.e. we're using a string other
-# than the build type string itself in the install path.
-#
-# In the event of multiple configuration switches we need to avoid matching 
failures
-# due to previous substitutions, so the first time we do this stash the 
original
-# contents in cmake_install.cmake.orig file.
-string(REPLACE "----BUILD_TYPE----" "\${BUILD_TYPE}" 
CMAKE_INSTALL_PREFIX_CFG_ORIG "@CMAKE_INSTALL_PREFIX_CFG@")
-if(NOT "${BUILD_TYPE_NEW}" STREQUAL "${BUILD_TYPE}")
-  file(GLOB_RECURSE ALL_CMAKE_INSTALL_FILES "cmake_install.cmake")
-  foreach(cmake_install_file ${ALL_CMAKE_INSTALL_FILES})
-    if(EXISTS "${cmake_install_file}.orig")
-      file(READ "${cmake_install_file}.orig" OLD_INSTALL_CONTENTS)
-    else(EXISTS "${cmake_install_file}.orig")
-      file(READ "${cmake_install_file}" OLD_INSTALL_CONTENTS)
-      file(WRITE "${cmake_install_file}.orig" "\n${OLD_INSTALL_CONTENTS}")
-    endif(EXISTS "${cmake_install_file}.orig")
-    string(REPLACE "${CMAKE_INSTALL_PREFIX_CFG_ORIG}" 
"${CMAKE_INSTALL_PREFIX_CFG}" INSTALL_CONTENTS "${OLD_INSTALL_CONTENTS}")
-    string(REPLACE "@CMAKE_BINARY_DIR@/@CMAKE_CFG_INTDIR@" 
"@CMAKE_BINARY_DIR@/${BUILD_TYPE}" INSTALL_CONTENTS "${INSTALL_CONTENTS}")
-    file(WRITE "${cmake_install_file}" "${INSTALL_CONTENTS}")
-  endforeach(cmake_install_file ${ALL_CMAKE_INSTALL_FILES})
-endif(NOT "${BUILD_TYPE_NEW}" STREQUAL "${BUILD_TYPE}")
+# directly.
 
+file(GLOB_RECURSE ALL_CMAKE_INSTALL_FILES "cmake_install.cmake")
+foreach(cmake_install_file ${ALL_CMAKE_INSTALL_FILES})
+
+  # We need to work with the original state of the cmake_install.cmake file
+  # for consistency, so stash a copy if we haven't already done so.
+  if(EXISTS "${cmake_install_file}.orig")
+    file(READ "${cmake_install_file}.orig" OLD_INSTALL_CONTENTS)
+  else(EXISTS "${cmake_install_file}.orig")
+    file(READ "${cmake_install_file}" OLD_INSTALL_CONTENTS)
+    file(WRITE "${cmake_install_file}.orig" "\n${OLD_INSTALL_CONTENTS}")
+  endif(EXISTS "${cmake_install_file}.orig")
+
+  # Remove the obsolete previous state
+  file(REMOVE "${cmake_install_file}")
+
+  # Replace the original cmake_install contents with config specific info
+  set(INSTALL_CONTENTS "${OLD_INSTALL_CONTENTS}")
+  string(REPLACE "$<CONFIG>/" "${BUILD_TYPE}/" INSTALL_CONTENTS 
"${INSTALL_CONTENTS}")
+  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_KEY@" "${BUILD_TYPE_NEW}" INSTALL_CONTENTS 
"${INSTALL_CONTENTS}")
+  file(WRITE "${cmake_install_file}" "${INSTALL_CONTENTS}\n")
+
+endforeach(cmake_install_file ${ALL_CMAKE_INSTALL_FILES})
+
 # Local Variables:
 # tab-width: 8
 # mode: 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