Revision: 40485
http://brlcad.svn.sourceforge.net/brlcad/?rev=40485&view=rev
Author: starseeker
Date: 2010-09-06 19:35:36 +0000 (Mon, 06 Sep 2010)
Log Message:
-----------
Take a stab at a noprod rule, based partially on the uninstall example from the
CMake FAQ. This is an 'all or nothing' command - it will flush ALL lib and
exec products that cmake knows about, not just those in a single directory. If
we want per-directory control things are likely to get even trickier, if it can
be done.
Modified Paths:
--------------
brlcad/branches/cmake/CMakeLists.txt
Modified: brlcad/branches/cmake/CMakeLists.txt
===================================================================
--- brlcad/branches/cmake/CMakeLists.txt 2010-09-06 16:18:08 UTC (rev
40484)
+++ brlcad/branches/cmake/CMakeLists.txt 2010-09-06 19:35:36 UTC (rev
40485)
@@ -105,11 +105,16 @@
function(add_library name)
SET(CMAKE_LIBRARY_TARGET_LIST "${CMAKE_LIBRARY_TARGET_LIST};${name}" CACHE
STRING "list of lib targets" FORCE)
_add_library(${name} ${ARGN})
+ get_target_property(targetfile ${name} LOCATION)
+ STRING(REGEX REPLACE "liblib" "lib" targetvar "${targetfile}")
+ SET(CMAKE_LIBRARY_TARGET_FILE_LIST
"${CMAKE_LIBRARY_TARGET_FILE_LIST};${targetfile}" CACHE STRING "list of lib
target files" FORCE)
endfunction(add_library)
function(add_executable name)
SET(CMAKE_EXEC_TARGET_LIST "${CMAKE_EXEC_TARGET_LIST};${name}" CACHE STRING
"list of exec targets" FORCE)
_add_executable(${name} ${ARGN})
+ get_target_property(targetfile ${name} LOCATION)
+ SET(CMAKE_EXEC_TARGET_FILE_LIST
"${CMAKE_EXEC_TARGET_FILE_LIST};${targetfile}" CACHE STRING "list of exec
target files" FORCE)
endfunction(add_executable)
@@ -1352,6 +1357,7 @@
endif(externaltarget)
ENDFOREACH(externaltarget ${CMAKE_EXTERNAL_TARGET_LIST})
+
if(BRLCAD_BUILD_LOCAL_TCL)
ADD_DEPENDENCIES(tk tcl)
ADD_DEPENDENCIES(bu ${TCL_DEP} ${TK_DEP})
@@ -1359,6 +1365,51 @@
ADD_DEPENDENCIES(librt ${TCL_DEP} ${TK_DEP})
endif(BRLCAD_BUILD_LOCAL_TCL)
+
+
+
+# Set up the noprod rule. Currently this is an "all or nothing"
+# command that will clear ALL products for lib or exec targets,
+# not just those in a particular subdirectory.
+STRING(REGEX REPLACE ";" "\\\;" LIBRARY_TARGET_FILES
"${CMAKE_LIBRARY_TARGET_FILE_LIST}")
+STRING(REGEX REPLACE ";" "\\\;" EXEC_TARGET_FILES
"${CMAKE_EXEC_TARGET_FILE_LIST}")
+SET(noprod_file "
+SET(CMAKE_LIBRARY_TARGET_FILE_LIST \"${LIBRARY_TARGET_FILES}\")
+FOREACH(file \${CMAKE_LIBRARY_TARGET_FILE_LIST})
+ IF(EXISTS \${file})
+ MESSAGE(\"removing \${file}\\n\")
+ EXEC_PROGRAM(
+ ${CMAKE_COMMAND} ARGS \"-E remove \${file}\"
+ OUTPUT_VARIABLE rm_out
+ RETURN_VALUE rm_retval
+ )
+ IF(NOT \"\${rm_retval}\" STREQUAL 0)
+ MESSAGE(FATAL_ERROR \"Problem when removing \${file}\")
+ ENDIF(NOT \"\${rm_retval}\" STREQUAL 0)
+ ENDIF(EXISTS \${file})
+ENDFOREACH(file \${CMAKE_LIBRARY_TARGET_FILE_LIST})
+
+SET(CMAKE_EXEC_TARGET_FILE_LIST \"${EXEC_TARGET_FILES}\")
+FOREACH(file \${CMAKE_EXEC_TARGET_FILE_LIST})
+ IF(EXISTS \${file})
+ MESSAGE(\"removing \${file}\\n\")
+ EXEC_PROGRAM(
+ ${CMAKE_COMMAND} ARGS \"-E remove \${file}\"
+ OUTPUT_VARIABLE rm_out
+ RETURN_VALUE rm_retval
+ )
+ IF(NOT \"\${rm_retval}\" STREQUAL 0)
+ MESSAGE(FATAL_ERROR \"Problem when removing \${file}\")
+ ENDIF(NOT \"\${rm_retval}\" STREQUAL 0)
+ ENDIF(EXISTS \${file})
+ENDFOREACH(file \${CMAKE_EXEC_TARGET_FILE_LIST})
+")
+FILE(WRITE ${CMAKE_BINARY_DIR}/cmake_noprod.cmake ${noprod_file})
+ADD_CUSTOM_TARGET(noprod
+ "${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/cmake_noprod.cmake")
+
+
+
# Generate the include/conf files
# HOST
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:
Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits