Revision: 69020
http://sourceforge.net/p/brlcad/code/69020
Author: starseeker
Date: 2016-10-11 17:08:57 +0000 (Tue, 11 Oct 2016)
Log Message:
-----------
BRLCAD_TARGET_NAME is used in only one place. Also, since we're already
requiring 2.8.8 and the need for the file write hack disappeared in 2.8.7, the
whole thing simplifies nicely.
Modified Paths:
--------------
brlcad/trunk/misc/CMake/BRLCAD_Util.cmake
Modified: brlcad/trunk/misc/CMake/BRLCAD_Util.cmake
===================================================================
--- brlcad/trunk/misc/CMake/BRLCAD_Util.cmake 2016-10-11 16:48:07 UTC (rev
69019)
+++ brlcad/trunk/misc/CMake/BRLCAD_Util.cmake 2016-10-11 17:08:57 UTC (rev
69020)
@@ -48,32 +48,7 @@
message("${SEPARATOR_STRING}")
endfunction()
-#-----------------------------------------------------------------------------
-# For situations like file copying, where we sometimes need to autogenerate
-# target names, it is important to make sure we can avoid generating absurdly
-# long names. To do this, we run candidate names through a length filter
-# and use their MD5 hash if they are too long.
-macro(BRLCAD_TARGET_NAME input_string outputvar)
- string(REGEX REPLACE "/" "_" targetstr ${input_string})
- string(REGEX REPLACE "\\." "_" targetstr ${targetstr})
- string(LENGTH "${targetstr}" STRLEN)
- # If the input string is longer than 30 characters, generate a
- # shorter string using the md5 hash. It will be cryptic but
- # the odds are very good it'll be a unique target name
- # and the string will be short enough, which is what we need.
- if ("${STRLEN}" GREATER 30)
- file(WRITE "${CMAKE_BINARY_DIR}/CMakeTmp/MD5CONTENTS" "${targetstr}")
- execute_process(COMMAND ${CMAKE_COMMAND} -E md5sum
"${CMAKE_BINARY_DIR}/CMakeTmp/MD5CONTENTS" OUTPUT_VARIABLE targetname)
- string(REPLACE " ${CMAKE_BINARY_DIR}/CMakeTmp/MD5CONTENTS" "" targetname
"${targetname}")
- string(STRIP "${targetname}" targetname)
- file(REMOVE "${CMAKE_BINARY_DIR}/CMakeTmp/MD5CONTENTS")
- set(${outpvar} ${targetname})
- else ("${STRLEN}" GREATER 30)
- set(${outputvar} "${targetstr}")
- endif ("${STRLEN}" GREATER 30)
-endmacro(BRLCAD_TARGET_NAME)
-
#-----------------------------------------------------------------------------
# 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.
@@ -96,11 +71,32 @@
# Put the list contents in the targetvar variable and
# generate a target name.
if(NOT havevarname)
+
set(${targetvar} "${inlist}")
- BRLCAD_TARGET_NAME("${inlist}" targetname)
+
+ # Initial clean-up
+ string(REGEX REPLACE " " "_" targetstr "${inlist}")
+ string(REGEX REPLACE "/" "_" targetstr "${targetstr}")
+ string(REGEX REPLACE "\\." "_" targetstr "${targetstr}")
+
+ # For situations like file copying, where we sometimes need to autogenerate
+ # target names, it is important to make sure we can avoid generating
absurdly
+ # long names. To do this, we run candidate names through a length filter
+ # and use their MD5 hash if they are longer than 30 characters.
+ # It's cryptic but the odds are very good the result will be a unique
+ # target name and the string will be short enough, which is what we need.
+ string(LENGTH "${targetstr}" STRLEN)
+ if ("${STRLEN}" GREATER 30)
+ string(MD5 targetname "${targetstr}")
+ else ("${STRLEN}" GREATER 30)
+ set(targetname "${targetstr}")
+ endif ("${STRLEN}" GREATER 30)
+
else(NOT havevarname)
+
set(${targetvar} "${${inlist}}")
set(targetname "${inlist}")
+
endif(NOT havevarname)
# Mark the inputs as files to ignore in distcheck
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits