Revision: 69958
          http://sourceforge.net/p/brlcad/code/69958
Author:   starseeker
Date:     2017-07-16 21:23:19 +0000 (Sun, 16 Jul 2017)
Log Message:
-----------
Reorganize some logic

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

Removed Paths:
-------------
    brlcad/trunk/misc/CMake/BRLCAD_CMakeFiles.cmake

Modified: brlcad/trunk/CMakeLists.txt
===================================================================
--- brlcad/trunk/CMakeLists.txt 2017-07-16 20:25:59 UTC (rev 69957)
+++ brlcad/trunk/CMakeLists.txt 2017-07-16 21:23:19 UTC (rev 69958)
@@ -78,39 +78,6 @@
 # This file contains the top level CMakeLists.txt logic for the
 # BRL-CAD software package.
 
-
-# We want to support a "distclean" build target that will clear all
-# CMake-generated files from a source directory in the case of an
-# in-source-dir configuration.  Not recommended, but we'll try to
-# recover if it happens.
-define_property(GLOBAL PROPERTY CMAKE_DISTCLEAN_TARGET_LIST BRIEF_DOCS "All 
CMake generated files" FULL_DOCS "List of all files generated by CMake")
-function(distclean)
-  foreach(item ${ARGN})
-    set_property(GLOBAL APPEND PROPERTY CMAKE_DISTCLEAN_TARGET_LIST "${item}")
-  endforeach(item ${ARGN})
-endfunction(distclean)
-
-# Used a variation on Fraser's approach for capturing command line args from
-# 
http://stackoverflow.com/questions/10205986/how-to-capture-cmake-command-line-arguments
-# to log what variables have been passed in from the user via -D arguments - 
haven't
-# found a variable that saves the original ARGV list except for those defined 
in
-# -P script mode, which doesn't help here.
-get_cmake_property(VARS VARIABLES)
-foreach(VAR ${VARS})
-  get_property(VAR_HELPSTRING CACHE ${VAR} PROPERTY HELPSTRING)
-  # Rather than look for "No help, variable specified on the command line."
-  # exactly, match a slightly more robust subset...
-  string(TOLOWER "${VAR_HELPSTRING}" VAR_HELPSTRING)
-  if("${VAR_HELPSTRING}" MATCHES "specified on the command line")
-    get_property(VAR_TYPE CACHE ${VAR} PROPERTY TYPE)
-    if(NOT VAR_TYPE STREQUAL "UNINITIALIZED")
-      set(VAR "${VAR}:${VAR_TYPE}")
-    endif(NOT VAR_TYPE STREQUAL "UNINITIALIZED")
-    set(CMAKE_ARGS "${CMAKE_ARGS} -D${VAR}=${${VAR}}")
-  endif("${VAR_HELPSTRING}" MATCHES "specified on the command line")
-endforeach(VAR ${VARS})
-file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeOutput.log" 
"${CMAKE_COMMAND} \"${CMAKE_SOURCE_DIR}\" ${CMAKE_ARGS}\n")
-
 # Minimum required version of CMake
 cmake_minimum_required(VERSION 2.8.8)
 if(COMMAND CMAKE_POLICY)
@@ -129,7 +96,20 @@
 # set CMake project name
 project(BRLCAD)
 
+#---------------------------------------------------------------------
+# Define the current BRL-CAD version.
+# See HACKING for details on how to properly update the version
 
+file(READ "${BRLCAD_SOURCE_DIR}/include/conf/MAJOR" BRLCAD_VERSION_MAJOR)
+string(STRIP ${BRLCAD_VERSION_MAJOR} BRLCAD_VERSION_MAJOR)
+file(READ "${BRLCAD_SOURCE_DIR}/include/conf/MINOR" BRLCAD_VERSION_MINOR)
+string(STRIP ${BRLCAD_VERSION_MINOR} BRLCAD_VERSION_MINOR)
+file(READ "${BRLCAD_SOURCE_DIR}/include/conf/PATCH" BRLCAD_VERSION_PATCH)
+string(STRIP ${BRLCAD_VERSION_PATCH} BRLCAD_VERSION_PATCH)
+
+set(BRLCAD_VERSION 
"${BRLCAD_VERSION_MAJOR}.${BRLCAD_VERSION_MINOR}.${BRLCAD_VERSION_PATCH}")
+
+#---------------------------------------------------------------------
 # Let CMake know where to look for our counting file for configuration
 # passes.  It will impact whether we print certain messages
 set(BRLCAD_CNT_FILE "${BRLCAD_BINARY_DIR}/CMakeTmp/BRLCAD_BUILD_COUNT")
@@ -139,34 +119,27 @@
   set(BRLCAD_PRINT_MSGS 0)
 endif(NOT EXISTS ${BRLCAD_CNT_FILE})
 
+# Make sure the BRL-CAD library list is initialized empty - this way
+# if pieces are disabled between one configure and the next, they
+# won't linger in the list
+set(BRLCAD_LIBS "" CACHE STRING "BRL-CAD libraries" FORCE)
 
-# Wrap the default message() function to also append ALL messages to a
-# CMakeOutput.log file in addition to usual console printing.
-# Note - only do this after calling project, since this override seems to do
-# unexpected things to the messages returned by that command
 
-function(message)
+#---------------------------------------------------------------------
+# Load general utility routines for BRL-CAD CMake logic
+include("${CMAKE_SOURCE_DIR}/misc/CMake/BRLCAD_Util.cmake")
 
-  # bleh, don't know a clean+safe way to avoid string comparing the
-  # optional arg, so we extract it and test.
-  list(GET ARGV 0 MessageType)
+#---------------------------------------------------------------------
+# Record the CMake command line arguments (more or less) in
+# CMakeFiles/CMakeOutput.log
+record_cmdline_args()
 
-  if (MessageType STREQUAL FATAL_ERROR OR MessageType STREQUAL SEND_ERROR OR 
MessageType STREQUAL WARNING OR MessageType STREQUAL AUTHOR_WARNING OR 
MessageType STREQUAL STATUS)
-    list(REMOVE_AT ARGV 0)
-    _message(${MessageType} "${ARGV}")
-    file(APPEND "${BRLCAD_BINARY_DIR}/CMakeFiles/CMakeOutput.log" 
"${MessageType}: ${ARGV}\n")
-  else (MessageType STREQUAL FATAL_ERROR OR MessageType STREQUAL SEND_ERROR OR 
MessageType STREQUAL WARNING OR MessageType STREQUAL AUTHOR_WARNING OR 
MessageType STREQUAL STATUS)
-    _message("${ARGV}")
-    file(APPEND "${BRLCAD_BINARY_DIR}/CMakeFiles/CMakeOutput.log" "${ARGV}\n")
-  endif (MessageType STREQUAL FATAL_ERROR OR MessageType STREQUAL SEND_ERROR 
OR MessageType STREQUAL WARNING OR MessageType STREQUAL AUTHOR_WARNING OR 
MessageType STREQUAL STATUS)
+#---------------------------------------------------------------------
+# Set up the necessary support for timing of the configuration and
+# build processes
+set_config_time()
+#generate_timer_exes()
 
-  # ~10% slower alternative that avoids adding '--' to STATUS messages
-  # execute_process(COMMAND ${CMAKE_COMMAND} -E echo "${ARGV}")
-
-endfunction(message)
-
-
-
 #---------------------------------------------------------------------
 # Write out entries to populate a tm struct (will be used for time
 # delta calculations later)
@@ -205,6 +178,11 @@
 
 
 #---------------------------------------------------------------------
+# Mark the time at which the configuration process began.
+#set(DELTA_START "${CMAKE_BINARY_DIR}/CMakeTmp/DELTA_START")
+#execute_process(COMMAND "${CMAKE_BINARY_DIR}/CMakeTmp/sstamp" 
"${DELTA_START}")
+
+#---------------------------------------------------------------------
 # Allow the BRLCAD_ROOT environment variable to set CMAKE_INSTALL_PREFIX
 # but be noisy about it.  This is generally not a good idea.
 find_program(SLEEP_EXEC sleep)
@@ -247,34 +225,8 @@
   endif(SLEEP_EXEC)
 endif(BRLCAD_DATA_ENV)
 
-#---------------------------------------------------------------------
-# Load general utility routines for BRL-CAD CMake logic
-include("${CMAKE_SOURCE_DIR}/misc/CMake/BRLCAD_Util.cmake")
 
-# Define CMake routines for bookkeeping of build files
-include("${CMAKE_SOURCE_DIR}/misc/CMake/BRLCAD_CMakeFiles.cmake")
-
-# Make sure the BRL-CAD library list is initialized empty - this way
-# if pieces are disabled between one configure and the next, they
-# won't linger in the list
-set(BRLCAD_LIBS "" CACHE STRING "BRL-CAD libraries" FORCE)
-
-
 #---------------------------------------------------------------------
-# Define the current BRL-CAD version.
-# See HACKING for details on how to properly update the version
-
-file(READ "${BRLCAD_SOURCE_DIR}/include/conf/MAJOR" BRLCAD_VERSION_MAJOR)
-string(STRIP ${BRLCAD_VERSION_MAJOR} BRLCAD_VERSION_MAJOR)
-file(READ "${BRLCAD_SOURCE_DIR}/include/conf/MINOR" BRLCAD_VERSION_MINOR)
-string(STRIP ${BRLCAD_VERSION_MINOR} BRLCAD_VERSION_MINOR)
-file(READ "${BRLCAD_SOURCE_DIR}/include/conf/PATCH" BRLCAD_VERSION_PATCH)
-string(STRIP ${BRLCAD_VERSION_PATCH} BRLCAD_VERSION_PATCH)
-
-set(BRLCAD_VERSION 
"${BRLCAD_VERSION_MAJOR}.${BRLCAD_VERSION_MINOR}.${BRLCAD_VERSION_PATCH}")
-
-
-#---------------------------------------------------------------------
 # CMake derives much of its functionality from modules, typically
 # stored in one directory - let CMake know where to find them.  If we
 # are a subbuild, let the parent's CMAKE_MODULE_PATH supply files before
@@ -810,10 +762,6 @@
 endif(UMASK_EXEC)
 
 #---------------------------------------------------------------------
-set_config_time()
-
-
-#---------------------------------------------------------------------
 # print out the title with a pretty box computed to wrap around
 BOX_PRINT("*** Configuring BRL-CAD Release ${BRLCAD_VERSION}, Build 
${CONFIG_DATE} ***" "*")
 

Deleted: brlcad/trunk/misc/CMake/BRLCAD_CMakeFiles.cmake
===================================================================
--- brlcad/trunk/misc/CMake/BRLCAD_CMakeFiles.cmake     2017-07-16 20:25:59 UTC 
(rev 69957)
+++ brlcad/trunk/misc/CMake/BRLCAD_CMakeFiles.cmake     2017-07-16 21:23:19 UTC 
(rev 69958)
@@ -1,167 +0,0 @@
-#          B R L C A D _ C M A K E F I L E S . C M A K E
-# BRL-CAD
-#
-# Copyright (c) 2011-2016 United States Government as represented by
-# the U.S. Army Research Laboratory.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# 2. Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following
-# disclaimer in the documentation and/or other materials provided
-# with the distribution.
-#
-# 3. The name of the author may not be used to endorse or promote
-# products derived from this software without specific prior written
-# permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
-# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
-# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
-# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-
-# Define a macro for building lists of files.  Distcheck needs to know
-# what files are "supposed" to be present in order to make sure the
-# source tree is clean prior to building a distribution tarball, hence
-# this macro stores its results in files and not variables  It's a
-# no-op in a SUBBUILD.
-#
-# For this macro to work correctly, it is important that any target
-# definitions or explicit calls to this macro supply relative paths for
-# files present in the source tree.  Generated files fed into
-# compilation targets are not one of the things that should be in lists
-# generated by this macro, and the only way to reliably recognize them
-# is to reject files specified using their full path.  Such files must
-# use their full path in the build logic in order for out-of-src-dir
-# builds to function, so as long as no full paths are used for files
-# actually IN the source tree this method is reliable.  The macro will
-# try to catch improperly specified files, but if the build directory
-# and the source directory are one and the same this will not be
-# possible.
-
-define_property(GLOBAL PROPERTY CMAKE_IGNORE_FILES BRIEF_DOCS "distcheck 
ignore files" FULL_DOCS "List of files known to CMake")
-define_property(GLOBAL PROPERTY CMAKE_IGNORE_DIRS BRIEF_DOCS "distcheck ignore 
dirs" FULL_DOCS "List of directories marked as fully known to CMake")
-
-macro(CMAKEFILES)
-  if(NOT BRLCAD_IS_SUBBUILD)
-    foreach(ITEM ${ARGN})
-      set(CMAKEFILES_DO_TEST 1)
-      # The build targets will use certain keywords for arguments -
-      # before we proceed to do any ignoring based on those names,
-      # make sure the file is there.  Normally attempting to ignore
-      # a non-existent file is a fatal error, but these keywords
-      # don't necessarily refer to files.
-      set(TARGET_FLAGS SHARED STATIC OBJECT WIN32 UNKNOWN IMPORTED MODULE 
INTERFACE)
-      foreach(TARGET_FLAG ${TARGET_FLAGS})
-       if("${TARGET_FLAG}" STREQUAL "${ITEM}")
-         if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
-            set(CMAKEFILES_DO_TEST 0)
-         endif(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
-       endif("${TARGET_FLAG}" STREQUAL "${ITEM}")
-      endforeach(TARGET_FLAG ${TARGET_FLAGS})
-      set(FUZZY_TARGET_FLAGS TARGET_OBJECTS)
-      foreach(TARGET_FLAG ${FUZZY_TARGET_FLAGS})
-       if("${ITEM}" MATCHES "${TARGET_FLAG}")
-         if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
-            set(CMAKEFILES_DO_TEST 0)
-         endif(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
-       endif("${ITEM}" MATCHES "${TARGET_FLAG}")
-      endforeach(TARGET_FLAG ${FUZZY_TARGET_FLAGS})
-
-      # Handled target flags, proceeding with tests.
-      if(CMAKEFILES_DO_TEST)
-       get_filename_component(ITEM_PATH "${ITEM}" PATH)
-       get_filename_component(ITEM_NAME "${ITEM}" NAME)
-       if(NOT "${ITEM_PATH}" STREQUAL "")
-         # If the build directory is not the same as the source
-          # directory, we can enforce the convention that only
-          # generated files be specified with their full name.
-          # If this becomes a problem with the third party build
-          # systems at some point in the future, we may have to
-          # exclude src/other paths from this check.
-         if(NOT "${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
-           IS_SUBPATH("${CMAKE_BINARY_DIR}" "${ITEM_PATH}" SUBPATH_TEST)
-           if("${SUBPATH_TEST}" STREQUAL "0")
-             IS_SUBPATH("${CMAKE_SOURCE_DIR}" "${ITEM_PATH}" SUBPATH_TEST)
-             if("${SUBPATH_TEST}" STREQUAL "1")
-               message(FATAL_ERROR "${ITEM} is listed in 
\"${CMAKE_CURRENT_SOURCE_DIR}\" using its absolute path.  Please specify the 
location of this file using a relative path.")
-             endif("${SUBPATH_TEST}" STREQUAL "1")
-           endif("${SUBPATH_TEST}" STREQUAL "0")
-         endif(NOT "${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
-         # Ignore files specified using full paths, since they
-          # should be generated files and are not part of the
-          # source code repository.
-         get_filename_component(ITEM_ABS_PATH "${ITEM_PATH}" ABSOLUTE)
-         if(NOT "${ITEM_PATH}" STREQUAL "${ITEM_ABS_PATH}")
-           if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
-             message(FATAL_ERROR "Attempting to ignore non-existent file 
${ITEM}, in directory \"${CMAKE_CURRENT_SOURCE_DIR}\"")
-           endif(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
-           # Append files and directories to their respective lists.
-           if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
-             set_property(GLOBAL APPEND PROPERTY CMAKE_IGNORE_DIRS 
"${ITEM_ABS_PATH}/${ITEM_NAME}")
-           else(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
-             set_property(GLOBAL APPEND PROPERTY CMAKE_IGNORE_FILES 
"${ITEM_ABS_PATH}/${ITEM_NAME}")
-           endif(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
-           set_property(GLOBAL APPEND PROPERTY CMAKE_IGNORE_FILES 
"${ITEM_ABS_PATH}")
-           # Add the parent directories of the specified file or directory as 
well -
-           # the convention is that once at least one file or directory in a 
path is recorded
-           # by the build logic, the parent directories along that path have 
also been recorded.
-           while(NOT "${ITEM_PATH}" STREQUAL "")
-             get_filename_component(ITEM_NAME "${ITEM_PATH}" NAME)
-             get_filename_component(ITEM_PATH "${ITEM_PATH}" PATH)
-             if(NOT "${ITEM_PATH}" STREQUAL "")
-               get_filename_component(ITEM_ABS_PATH "${ITEM_PATH}" ABSOLUTE)
-               if(NOT "${ITEM_NAME}" STREQUAL "..")
-                 set_property(GLOBAL APPEND PROPERTY CMAKE_IGNORE_FILES 
"${ITEM_ABS_PATH}")
-               endif(NOT "${ITEM_NAME}" STREQUAL "..")
-             endif(NOT "${ITEM_PATH}" STREQUAL "")
-           endwhile(NOT "${ITEM_PATH}" STREQUAL "")
-         endif(NOT "${ITEM_PATH}" STREQUAL "${ITEM_ABS_PATH}")
-       else(NOT "${ITEM_PATH}" STREQUAL "")
-         # The easy case - no path specified, so assume the current source 
directory.
-         if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
-           message(FATAL_ERROR "Attempting to ignore non-existent file 
${ITEM}, in directory \"${CMAKE_CURRENT_SOURCE_DIR}\"")
-         endif(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
-         if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
-           set_property(GLOBAL APPEND PROPERTY CMAKE_IGNORE_DIRS 
"${CMAKE_CURRENT_SOURCE_DIR}/${ITEM_NAME}")
-         else(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
-           set_property(GLOBAL APPEND PROPERTY CMAKE_IGNORE_FILES 
"${CMAKE_CURRENT_SOURCE_DIR}/${ITEM_NAME}")
-         endif(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
-       endif(NOT "${ITEM_PATH}" STREQUAL "")
-      endif(CMAKEFILES_DO_TEST)
-    endforeach(ITEM ${ARGN})
-  endif(NOT BRLCAD_IS_SUBBUILD)
-endmacro(CMAKEFILES FILESLIST)
-
-# Routine to tell distcheck to ignore a series of items in a directory.  Items 
may themselves
-# be directories.  Primarily useful when working with src/other dist lists.
-macro(CMAKEFILES_IN_DIR filestoignore targetdir)
-  if(NOT BRLCAD_IS_SUBBUILD)
-    set(CMAKE_IGNORE_LIST "")
-    foreach(filepath ${${filestoignore}})
-      set(CMAKE_IGNORE_LIST ${CMAKE_IGNORE_LIST} "${targetdir}/${filepath}")
-    endforeach(filepath ${filestoignore})
-    CMAKEFILES(${CMAKE_IGNORE_LIST})
-  endif(NOT BRLCAD_IS_SUBBUILD)
-endmacro(CMAKEFILES_IN_DIR)
-
-# Local Variables:
-# tab-width: 8
-# mode: cmake
-# indent-tabs-mode: t
-# End:
-# ex: shiftwidth=2 tabstop=8

Modified: brlcad/trunk/misc/CMake/BRLCAD_Util.cmake
===================================================================
--- brlcad/trunk/misc/CMake/BRLCAD_Util.cmake   2017-07-16 20:25:59 UTC (rev 
69957)
+++ brlcad/trunk/misc/CMake/BRLCAD_Util.cmake   2017-07-16 21:23:19 UTC (rev 
69958)
@@ -33,7 +33,70 @@
 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
 ###
+
 #-----------------------------------------------------------------------------
+# We want to support a "distclean" build target that will clear all
+# CMake-generated files from a source directory in the case of an
+# in-source-dir configuration.  Not recommended, but we'll try to
+# recover if it happens.
+define_property(GLOBAL PROPERTY CMAKE_DISTCLEAN_TARGET_LIST BRIEF_DOCS "All 
CMake generated files" FULL_DOCS "List of all files generated by CMake")
+function(distclean)
+  foreach(item ${ARGN})
+    set_property(GLOBAL APPEND PROPERTY CMAKE_DISTCLEAN_TARGET_LIST "${item}")
+  endforeach(item ${ARGN})
+endfunction(distclean)
+
+#-----------------------------------------------------------------------------
+# Use a variation on Fraser's approach for capturing command line args from
+# 
http://stackoverflow.com/questions/10205986/how-to-capture-cmake-command-line-arguments
+# to log what variables have been passed in from the user via -D arguments - 
haven't
+# found a variable that saves the original ARGV list except for those defined 
in
+# -P script mode, which doesn't help here.
+function(record_cmdline_args)
+  get_cmake_property(VARS VARIABLES)
+  foreach(VAR ${VARS})
+    get_property(VAR_HELPSTRING CACHE ${VAR} PROPERTY HELPSTRING)
+    # Rather than look for "No help, variable specified on the command line."
+    # exactly, match a slightly more robust subset...
+    string(TOLOWER "${VAR_HELPSTRING}" VAR_HELPSTRING)
+    if("${VAR_HELPSTRING}" MATCHES "specified on the command line")
+      get_property(VAR_TYPE CACHE ${VAR} PROPERTY TYPE)
+      if(NOT VAR_TYPE STREQUAL "UNINITIALIZED")
+       set(VAR "${VAR}:${VAR_TYPE}")
+      endif(NOT VAR_TYPE STREQUAL "UNINITIALIZED")
+      set(CMAKE_ARGS "${CMAKE_ARGS} -D${VAR}=${${VAR}}")
+    endif("${VAR_HELPSTRING}" MATCHES "specified on the command line")
+  endforeach(VAR ${VARS})
+  file(APPEND "${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log" 
"${CMAKE_COMMAND} \"${CMAKE_SOURCE_DIR}\" ${CMAKE_ARGS}\n")
+endfunction(record_cmdline_args)
+
+#---------------------------------------------------------------------
+# Wrap the default message() function to also append ALL messages to a
+# CMakeOutput.log file in addition to usual console printing.
+# Note - only do this after calling project, since this override seems to do
+# unexpected things to the messages returned by that command
+
+function(message)
+
+  # bleh, don't know a clean+safe way to avoid string comparing the
+  # optional arg, so we extract it and test.
+  list(GET ARGV 0 MessageType)
+
+  if (MessageType STREQUAL FATAL_ERROR OR MessageType STREQUAL SEND_ERROR OR 
MessageType STREQUAL WARNING OR MessageType STREQUAL AUTHOR_WARNING OR 
MessageType STREQUAL STATUS)
+    list(REMOVE_AT ARGV 0)
+    _message(${MessageType} "${ARGV}")
+    file(APPEND "${BRLCAD_BINARY_DIR}/CMakeFiles/CMakeOutput.log" 
"${MessageType}: ${ARGV}\n")
+  else (MessageType STREQUAL FATAL_ERROR OR MessageType STREQUAL SEND_ERROR OR 
MessageType STREQUAL WARNING OR MessageType STREQUAL AUTHOR_WARNING OR 
MessageType STREQUAL STATUS)
+    _message("${ARGV}")
+    file(APPEND "${BRLCAD_BINARY_DIR}/CMakeFiles/CMakeOutput.log" "${ARGV}\n")
+  endif (MessageType STREQUAL FATAL_ERROR OR MessageType STREQUAL SEND_ERROR 
OR MessageType STREQUAL WARNING OR MessageType STREQUAL AUTHOR_WARNING OR 
MessageType STREQUAL STATUS)
+
+  # ~10% slower alternative that avoids adding '--' to STATUS messages
+  # execute_process(COMMAND ${CMAKE_COMMAND} -E echo "${ARGV}")
+
+endfunction(message)
+
+#-----------------------------------------------------------------------------
 # Pretty-printing macro that generates a box around a string and prints the
 # resulting message.
 function(BOX_PRINT input_string border_string)
@@ -48,7 +111,185 @@
   message("${SEPARATOR_STRING}")
 endfunction()
 
+#-----------------------------------------------------------------------------
+# We need a way to tell whether one path is a subpath of another path without
+# relying on regular expressions, since file paths may have characters in them
+# that will trigger regex matching behavior when we don't want it.  (To test,
+# for example, use a build directory name of build++)
+#
+# Sets ${result_var} to 1 if the candidate subpath is actually a subpath of
+# the supplied "full" path, otherwise sets it to 0.
+#
+# The routine below does the check without using regex matching, in order to
+# handle path names that contain characters that would be interpreted as active
+# in a regex string.
+function(IS_SUBPATH in_candidate_subpath in_full_path result_var)
+  # Convert paths to lists of directories - regex based
+  # matching won't work reliably, so instead look at each
+  # element compared to its corresponding element in the
+  # other path using string comparison.
 
+  # get the CMake form of the path so we have something consistent
+  # to work on
+  file(TO_CMAKE_PATH "${in_full_path}" full_path)
+  file(TO_CMAKE_PATH "${in_candidate_subpath}" candidate_subpath)
+
+  # check the string lengths - if the "subpath" is longer
+  # than the full path, there's not point in going further
+  string(LENGTH "${full_path}" FULL_LENGTH)
+  string(LENGTH "${candidate_subpath}" SUB_LENGTH)
+  if("${SUB_LENGTH}" GREATER "${FULL_LENGTH}")
+    set(${result_var} 0 PARENT_SCOPE)
+  else("${SUB_LENGTH}" GREATER "${FULL_LENGTH}")
+    # OK, maybe it's a subpath - time to actually check
+    string(REPLACE "/" ";" full_path_list "${full_path}")
+    string(REPLACE "/" ";" candidate_subpath_list "${candidate_subpath}")
+    set(found_difference 0)
+    while(NOT found_difference AND candidate_subpath_list)
+      list(GET full_path_list 0 full_path_element)
+      list(GET candidate_subpath_list 0 subpath_element)
+      if("${full_path_element}" STREQUAL "${subpath_element}")
+       list(REMOVE_AT full_path_list 0)
+       list(REMOVE_AT candidate_subpath_list 0)
+      else("${full_path_element}" STREQUAL "${subpath_element}")
+       set(found_difference 1)
+      endif("${full_path_element}" STREQUAL "${subpath_element}")
+    endwhile(NOT found_difference AND candidate_subpath_list)
+    # Now we know - report the result
+    if(NOT found_difference)
+      set(${result_var} 1 PARENT_SCOPE)
+    else(NOT found_difference)
+      set(${result_var} 0 PARENT_SCOPE)
+    endif(NOT found_difference)
+  endif("${SUB_LENGTH}" GREATER "${FULL_LENGTH}")
+endfunction(IS_SUBPATH)
+
+#---------------------------------------------------------------------
+# Define a macro for building lists of files.  Distcheck needs to know
+# what files are "supposed" to be present in order to make sure the
+# source tree is clean prior to building a distribution tarball, hence
+# this macro stores its results in files and not variables  It's a
+# no-op in a SUBBUILD.
+#
+# For this macro to work correctly, it is important that any target
+# definitions or explicit calls to this macro supply relative paths for
+# files present in the source tree.  Generated files fed into
+# compilation targets are not one of the things that should be in lists
+# generated by this macro, and the only way to reliably recognize them
+# is to reject files specified using their full path.  Such files must
+# use their full path in the build logic in order for out-of-src-dir
+# builds to function, so as long as no full paths are used for files
+# actually IN the source tree this method is reliable.  The macro will
+# try to catch improperly specified files, but if the build directory
+# and the source directory are one and the same this will not be
+# possible.
+
+define_property(GLOBAL PROPERTY CMAKE_IGNORE_FILES BRIEF_DOCS "distcheck 
ignore files" FULL_DOCS "List of files known to CMake")
+define_property(GLOBAL PROPERTY CMAKE_IGNORE_DIRS BRIEF_DOCS "distcheck ignore 
dirs" FULL_DOCS "List of directories marked as fully known to CMake")
+
+macro(CMAKEFILES)
+  if(NOT BRLCAD_IS_SUBBUILD)
+    foreach(ITEM ${ARGN})
+      set(CMAKEFILES_DO_TEST 1)
+      # The build targets will use certain keywords for arguments -
+      # before we proceed to do any ignoring based on those names,
+      # make sure the file is there.  Normally attempting to ignore
+      # a non-existent file is a fatal error, but these keywords
+      # don't necessarily refer to files.
+      set(TARGET_FLAGS SHARED STATIC OBJECT WIN32 UNKNOWN IMPORTED MODULE 
INTERFACE)
+      foreach(TARGET_FLAG ${TARGET_FLAGS})
+       if("${TARGET_FLAG}" STREQUAL "${ITEM}")
+         if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
+            set(CMAKEFILES_DO_TEST 0)
+         endif(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
+       endif("${TARGET_FLAG}" STREQUAL "${ITEM}")
+      endforeach(TARGET_FLAG ${TARGET_FLAGS})
+      set(FUZZY_TARGET_FLAGS TARGET_OBJECTS)
+      foreach(TARGET_FLAG ${FUZZY_TARGET_FLAGS})
+       if("${ITEM}" MATCHES "${TARGET_FLAG}")
+         if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
+            set(CMAKEFILES_DO_TEST 0)
+         endif(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
+       endif("${ITEM}" MATCHES "${TARGET_FLAG}")
+      endforeach(TARGET_FLAG ${FUZZY_TARGET_FLAGS})
+
+      # Handled target flags, proceeding with tests.
+      if(CMAKEFILES_DO_TEST)
+       get_filename_component(ITEM_PATH "${ITEM}" PATH)
+       get_filename_component(ITEM_NAME "${ITEM}" NAME)
+       if(NOT "${ITEM_PATH}" STREQUAL "")
+         # If the build directory is not the same as the source
+          # directory, we can enforce the convention that only
+          # generated files be specified with their full name.
+          # If this becomes a problem with the third party build
+          # systems at some point in the future, we may have to
+          # exclude src/other paths from this check.
+         if(NOT "${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
+           IS_SUBPATH("${CMAKE_BINARY_DIR}" "${ITEM_PATH}" SUBPATH_TEST)
+           if("${SUBPATH_TEST}" STREQUAL "0")
+             IS_SUBPATH("${CMAKE_SOURCE_DIR}" "${ITEM_PATH}" SUBPATH_TEST)
+             if("${SUBPATH_TEST}" STREQUAL "1")
+               message(FATAL_ERROR "${ITEM} is listed in 
\"${CMAKE_CURRENT_SOURCE_DIR}\" using its absolute path.  Please specify the 
location of this file using a relative path.")
+             endif("${SUBPATH_TEST}" STREQUAL "1")
+           endif("${SUBPATH_TEST}" STREQUAL "0")
+         endif(NOT "${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
+         # Ignore files specified using full paths, since they
+          # should be generated files and are not part of the
+          # source code repository.
+         get_filename_component(ITEM_ABS_PATH "${ITEM_PATH}" ABSOLUTE)
+         if(NOT "${ITEM_PATH}" STREQUAL "${ITEM_ABS_PATH}")
+           if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
+             message(FATAL_ERROR "Attempting to ignore non-existent file 
${ITEM}, in directory \"${CMAKE_CURRENT_SOURCE_DIR}\"")
+           endif(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
+           # Append files and directories to their respective lists.
+           if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
+             set_property(GLOBAL APPEND PROPERTY CMAKE_IGNORE_DIRS 
"${ITEM_ABS_PATH}/${ITEM_NAME}")
+           else(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
+             set_property(GLOBAL APPEND PROPERTY CMAKE_IGNORE_FILES 
"${ITEM_ABS_PATH}/${ITEM_NAME}")
+           endif(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
+           set_property(GLOBAL APPEND PROPERTY CMAKE_IGNORE_FILES 
"${ITEM_ABS_PATH}")
+           # Add the parent directories of the specified file or directory as 
well -
+           # the convention is that once at least one file or directory in a 
path is recorded
+           # by the build logic, the parent directories along that path have 
also been recorded.
+           while(NOT "${ITEM_PATH}" STREQUAL "")
+             get_filename_component(ITEM_NAME "${ITEM_PATH}" NAME)
+             get_filename_component(ITEM_PATH "${ITEM_PATH}" PATH)
+             if(NOT "${ITEM_PATH}" STREQUAL "")
+               get_filename_component(ITEM_ABS_PATH "${ITEM_PATH}" ABSOLUTE)
+               if(NOT "${ITEM_NAME}" STREQUAL "..")
+                 set_property(GLOBAL APPEND PROPERTY CMAKE_IGNORE_FILES 
"${ITEM_ABS_PATH}")
+               endif(NOT "${ITEM_NAME}" STREQUAL "..")
+             endif(NOT "${ITEM_PATH}" STREQUAL "")
+           endwhile(NOT "${ITEM_PATH}" STREQUAL "")
+         endif(NOT "${ITEM_PATH}" STREQUAL "${ITEM_ABS_PATH}")
+       else(NOT "${ITEM_PATH}" STREQUAL "")
+         # The easy case - no path specified, so assume the current source 
directory.
+         if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
+           message(FATAL_ERROR "Attempting to ignore non-existent file 
${ITEM}, in directory \"${CMAKE_CURRENT_SOURCE_DIR}\"")
+         endif(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
+         if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
+           set_property(GLOBAL APPEND PROPERTY CMAKE_IGNORE_DIRS 
"${CMAKE_CURRENT_SOURCE_DIR}/${ITEM_NAME}")
+         else(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
+           set_property(GLOBAL APPEND PROPERTY CMAKE_IGNORE_FILES 
"${CMAKE_CURRENT_SOURCE_DIR}/${ITEM_NAME}")
+         endif(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${ITEM}")
+       endif(NOT "${ITEM_PATH}" STREQUAL "")
+      endif(CMAKEFILES_DO_TEST)
+    endforeach(ITEM ${ARGN})
+  endif(NOT BRLCAD_IS_SUBBUILD)
+endmacro(CMAKEFILES FILESLIST)
+
+# Routine to tell distcheck to ignore a series of items in a directory.  Items 
may themselves
+# be directories.  Primarily useful when working with src/other dist lists.
+macro(CMAKEFILES_IN_DIR filestoignore targetdir)
+  if(NOT BRLCAD_IS_SUBBUILD)
+    set(CMAKE_IGNORE_LIST "")
+    foreach(filepath ${${filestoignore}})
+      set(CMAKE_IGNORE_LIST ${CMAKE_IGNORE_LIST} "${targetdir}/${filepath}")
+    endforeach(filepath ${filestoignore})
+    CMAKEFILES(${CMAKE_IGNORE_LIST})
+  endif(NOT BRLCAD_IS_SUBBUILD)
+endmacro(CMAKEFILES_IN_DIR)
+
 #-----------------------------------------------------------------------------
 # It is sometimes convenient to be able to supply both a filename and a
 # variable name containing a list of files to a single macro.
@@ -130,6 +371,7 @@
 # this approach instead of directory properties because CMake's documentation
 # seems to indicate that directory properties also apply to subdirectories,
 # and we want these lists to be associated with one and only one directory.
+
 macro(BRLCAD_ADD_DIR_LIST_ENTRY list_name dir_in list_entry)
   string(REGEX REPLACE "/" "_" currdir_str ${dir_in})
   string(TOUPPER "${currdir_str}" currdir_str)
@@ -149,59 +391,6 @@
 
 
 #-----------------------------------------------------------------------------
-# We need a way to tell whether one path is a subpath of another path without
-# relying on regular expressions, since file paths may have characters in them
-# that will trigger regex matching behavior when we don't want it.  (To test,
-# for example, use a build directory name of build++)
-#
-# Sets ${result_var} to 1 if the candidate subpath is actually a subpath of
-# the supplied "full" path, otherwise sets it to 0.
-#
-# The routine below does the check without using regex matching, in order to
-# handle path names that contain characters that would be interpreted as active
-# in a regex string.
-function(IS_SUBPATH in_candidate_subpath in_full_path result_var)
-  # Convert paths to lists of directories - regex based
-  # matching won't work reliably, so instead look at each
-  # element compared to its corresponding element in the
-  # other path using string comparison.
-
-  # get the CMake form of the path so we have something consistent
-  # to work on
-  file(TO_CMAKE_PATH "${in_full_path}" full_path)
-  file(TO_CMAKE_PATH "${in_candidate_subpath}" candidate_subpath)
-
-  # check the string lengths - if the "subpath" is longer
-  # than the full path, there's not point in going further
-  string(LENGTH "${full_path}" FULL_LENGTH)
-  string(LENGTH "${candidate_subpath}" SUB_LENGTH)
-  if("${SUB_LENGTH}" GREATER "${FULL_LENGTH}")
-    set(${result_var} 0 PARENT_SCOPE)
-  else("${SUB_LENGTH}" GREATER "${FULL_LENGTH}")
-    # OK, maybe it's a subpath - time to actually check
-    string(REPLACE "/" ";" full_path_list "${full_path}")
-    string(REPLACE "/" ";" candidate_subpath_list "${candidate_subpath}")
-    set(found_difference 0)
-    while(NOT found_difference AND candidate_subpath_list)
-      list(GET full_path_list 0 full_path_element)
-      list(GET candidate_subpath_list 0 subpath_element)
-      if("${full_path_element}" STREQUAL "${subpath_element}")
-       list(REMOVE_AT full_path_list 0)
-       list(REMOVE_AT candidate_subpath_list 0)
-      else("${full_path_element}" STREQUAL "${subpath_element}")
-       set(found_difference 1)
-      endif("${full_path_element}" STREQUAL "${subpath_element}")
-    endwhile(NOT found_difference AND candidate_subpath_list)
-    # Now we know - report the result
-    if(NOT found_difference)
-      set(${result_var} 1 PARENT_SCOPE)
-    else(NOT found_difference)
-      set(${result_var} 0 PARENT_SCOPE)
-    endif(NOT found_difference)
-  endif("${SUB_LENGTH}" GREATER "${FULL_LENGTH}")
-endfunction(IS_SUBPATH)
-
-#-----------------------------------------------------------------------------
 # Determine whether a list of source files contains all C, all C++, or
 # mixed source types.
 function(SRCS_LANG sourceslist resultvar targetname)

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


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
BRL-CAD Source Commits mailing list
brlcad-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to