Revision: 77738
          http://sourceforge.net/p/brlcad/code/77738
Author:   starseeker
Date:     2020-11-13 14:48:19 +0000 (Fri, 13 Nov 2020)
Log Message:
-----------
Switch install command to using $<CONFIG>, per 
https://discourse.cmake.org/t/cmake-cfg-intdir-and-file-install/2169

Modified Paths:
--------------
    brlcad/branches/extbuild/src/tclscripts/CMakeLists.txt

Modified: brlcad/branches/extbuild/src/tclscripts/CMakeLists.txt
===================================================================
--- brlcad/branches/extbuild/src/tclscripts/CMakeLists.txt      2020-11-13 
04:02:12 UTC (rev 77737)
+++ brlcad/branches/extbuild/src/tclscripts/CMakeLists.txt      2020-11-13 
14:48:19 UTC (rev 77738)
@@ -27,13 +27,6 @@
     # normalize so we can use it as a name
     string(REGEX REPLACE "/" "_" name ${targetdir})
 
-    # divert output to diff paths depending on whether debug or release
-    if(CMAKE_CONFIGURATION_TYPES)
-      set(tclindex_outdir 
"${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${DATA_DIR}/${targetdir}")
-    else(CMAKE_CONFIGURATION_TYPES)
-      set(tclindex_outdir "${CMAKE_BINARY_DIR}/${DATA_DIR}/${targetdir}")
-    endif(CMAKE_CONFIGURATION_TYPES)
-
     # get file copy target(s) so we can make tclindex.tcl depend on them
     BRLCAD_GET_DIR_LIST_CONTENTS(DATA_TARGETS "${CMAKE_CURRENT_BINARY_DIR}" 
data_target_list)
 
@@ -42,6 +35,7 @@
     file(GLOB tcl_files "*.tcl")
 
     # command that builds the index when the dependency is resolved
+    set(tclindex_outdir 
"${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${DATA_DIR}/${targetdir}")
     add_custom_command(
       OUTPUT ${tclindex_outdir}/${outfile}
       COMMAND btclsh ${CMAKE_BINARY_DIR}/CMakeTmp/${cmd}.tcl 
${tclindex_outdir} >> ${CMAKE_CURRENT_BINARY_DIR}/${cmd}_index_gen.log 2>&1
@@ -48,8 +42,18 @@
       DEPENDS btclsh ${data_target_list} ${tcl_files}
       )
 
-    # put tclindex.tcl where it goes
-    install(FILES ${tclindex_outdir}/${outfile} DESTINATION 
${DATA_DIR}/${targetdir})
+    # Install logic for index file.
+    if(CMAKE_CONFIGURATION_TYPES)
+      # Need to use $<CONFIG> here rather than CMAKE_CFG_INTDIR
+      # as install in interpreted by CMake, not by the build tool.  See
+      # https://discourse.cmake.org/t/cmake-cfg-intdir-and-file-install/2169
+      install(FILES 
${CMAKE_BINARY_DIR}/$<CONFIG>/${DATA_DIR}/${targetdir}/${outfile} DESTINATION 
${DATA_DIR}/${targetdir})
+    else(CMAKE_CONFIGURATION_TYPES)
+      # CMAKE_CFG_INTDIR expands to "." in non-multiconfig builds, which is 
why we can use it universally in
+      # the add_custom_command logic.  However, $<CONFIG> may be Debug or 
Release even in a singlei
+      # configuration.  Therefore, we use a non-config specific path if we're 
not in multiconfig build mode.
+      install(FILES ${CMAKE_BINARY_DIR}/${DATA_DIR}/${targetdir}/${outfile} 
DESTINATION ${DATA_DIR}/${targetdir})
+    endif(CMAKE_CONFIGURATION_TYPES)
 
     # convenience target
     add_custom_target(${name}_${cmd}.tcl ALL DEPENDS 
${tclindex_outdir}/${outfile})

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