[brlcad-commits] SF.net SVN: brlcad:[49905] brlcad/trunk
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: <sta...@us...> - 2012-04-04 05:30:26
|
Revision: 49905 http://brlcad.svn.sourceforge.net/brlcad/?rev=49905&view=rev Author: starseeker Date: 2012-04-04 05:30:19 +0000 (Wed, 04 Apr 2012) Log Message: ----------- Take a stab at making configure_file cmakefiles appending more robust Modified Paths: -------------- brlcad/trunk/CMakeLists.txt brlcad/trunk/src/other/iwidgets/CMakeLists.txt brlcad/trunk/src/other/step/CMakeLists.txt brlcad/trunk/src/other/tcl/doc/CMakeLists.txt brlcad/trunk/src/other/tk/doc/CMakeLists.txt Modified: brlcad/trunk/CMakeLists.txt =================================================================== --- brlcad/trunk/CMakeLists.txt 2012-04-03 22:43:02 UTC (rev 49904) +++ brlcad/trunk/CMakeLists.txt 2012-04-04 05:30:19 UTC (rev 49905) @@ -404,19 +404,36 @@ # Override and wrap configure_file. In the case of configure_file, we'll # check that the file is part of the source tree and not itself a # generated file, but not reject full-path entries since there are quite a - # few of them. + # few of them. This means that, unlike CMAKEFILES's reliance on full vs. + # relative path comparisions, generated files supplied to configure_file + # need to have the GENERATED property set in order to reliably tell which + # files should be added to the build system's lists. Not + # so critical with not-in-src-dir builds, but makes a big difference + # spotting files to avoid when all generated files have source directory + # prefixes. function(configure_file file targetfile) _configure_file(${file} ${targetfile} ${ARGN}) - get_filename_component(item_absolute ${file} ABSOLUTE) - set(test_build_path "${CMAKE_BINARY_DIR}/") - set(test_source_path "${CMAKE_SOURCE_DIR}/") - string(REPLACE "${test_build_path}" "" build_dir_trimmed "${item_absolute}") - if(${item_absolute} STREQUAL ${build_dir_trimmed}) - string(REPLACE "${test_source_path}" "" source_dir_trimmed "${item_absolute}") - if(NOT ${item_absolute} STREQUAL ${source_dir_trimmed}) - file(APPEND ${CMAKE_BINARY_DIR}/cmakefiles.cmake "${item_absolute}\n") - endif(NOT ${item_absolute} STREQUAL ${source_dir_trimmed}) - endif(${item_absolute} STREQUAL ${build_dir_trimmed}) + # Tag output from configure with the GENERATED tag + set_source_files_properties(${targetfile} PROPERTIES GENERATED TRUE) + # If it's a generated file, don't register it + get_property(IS_GENERATED SOURCE ${file} PROPERTY GENERATED) + if(NOT IS_GENERATED) + get_filename_component(item_absolute ${file} ABSOLUTE) + # If we're not in the source dir, we can do some extra checking. + if(NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") + IS_SUBPATH("${CMAKE_BINARY_DIR}" "${item_absolute}" SUBPATH_TEST) + else(NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") + set(SUBPATH_TEST "0") + endif(NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") + if("${SUBPATH_TEST}" STREQUAL "0") + IS_SUBPATH("${CMAKE_SOURCE_DIR}" "${item_absolute}" SUBPATH_TEST) + if("${SUBPATH_TEST}" STREQUAL "1") + file(APPEND ${CMAKE_BINARY_DIR}/cmakefiles.cmake "${item_absolute}\n") + endif("${SUBPATH_TEST}" STREQUAL "1") + else("${SUBPATH_TEST}" STREQUAL "0") + message(WARNING "The generated file ${file} is passed to configure_file but does not have the GENERATED source file property set in CMake. It is HIGHLY recommended that the generated property be set for this file in ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt using a command with the following form:\nset_source_files_properties(<file> PROPERTIES GENERATED TRUE)\n(or in ${CMAKE_SOURCE_DIR}/src/other/CMakeLists.txt for third party components with their own build system.)\n") + endif("${SUBPATH_TEST}" STREQUAL "0") + endif(NOT IS_GENERATED) if(NOT ${targetfile} MATCHES "distclean") DISTCLEAN(${targetfile}) endif(NOT ${targetfile} MATCHES "distclean") @@ -700,6 +717,8 @@ # subprojects are also managing a config.h.in file of their own. set(CONFIG_H_FILE "${BRLCAD_BINARY_DIR}/include/brlcad_config.h.in") +set_source_files_properties(${CONFIG_H_FILE} PROPERTIES GENERATED TRUE) + set(CMAKE_CURRENT_PROJECT BRLCAD) define_property(GLOBAL PROPERTY BRLCAD_CONFIG_H_CONTENTS BRIEF_DOCS "config.h.in contents" FULL_DOCS "config.h.in contents for BRL-CAD project") Modified: brlcad/trunk/src/other/iwidgets/CMakeLists.txt =================================================================== --- brlcad/trunk/src/other/iwidgets/CMakeLists.txt 2012-04-03 22:43:02 UTC (rev 49904) +++ brlcad/trunk/src/other/iwidgets/CMakeLists.txt 2012-04-04 05:30:19 UTC (rev 49905) @@ -84,6 +84,7 @@ # Create the pkgIndex.tcl file and configure iwidgets.tcl. FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/pkgIndex.tcl "package ifneeded ${IWIDGETS_PKGNAME} ${IWIDGETS_PKGVERSION} [list source [file join $dir iwidgets.tcl]]") +set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/pkgIndex.tcl PROPERTIES GENERATED TRUE) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/iwidgets.tcl.in ${CMAKE_CURRENT_BINARY_DIR}/iwidgets.tcl) # Place files in build directory Modified: brlcad/trunk/src/other/step/CMakeLists.txt =================================================================== --- brlcad/trunk/src/other/step/CMakeLists.txt 2012-04-03 22:43:02 UTC (rev 49904) +++ brlcad/trunk/src/other/step/CMakeLists.txt 2012-04-04 05:30:19 UTC (rev 49905) @@ -207,6 +207,7 @@ # scl_cf.h.in - scripts may need to append to the template, so # it is read into memory initially. SET(CONFIG_H_FILE ${SCL_BINARY_DIR}/include/scl_cf.h.in) +set_source_files_properties(${CONFIG_H_FILE} PROPERTIES GENERATED TRUE) set(CMAKE_CURRENT_PROJECT SCL) define_property(GLOBAL PROPERTY SCL_CONFIG_H_CONTENTS BRIEF_DOCS "config.h.in contents" FULL_DOCS "config.h.in contents for SCL project") if(NOT COMMAND CONFIG_H_APPEND) Modified: brlcad/trunk/src/other/tcl/doc/CMakeLists.txt =================================================================== --- brlcad/trunk/src/other/tcl/doc/CMakeLists.txt 2012-04-03 22:43:02 UTC (rev 49904) +++ brlcad/trunk/src/other/tcl/doc/CMakeLists.txt 2012-04-04 05:30:19 UTC (rev 49905) @@ -255,6 +255,7 @@ IF(TCLMAN_GENERATED) FILE(GLOB TCL_MAN1 "${CMAKE_CURRENT_BINARY_DIR}/man1/*") foreach(man ${TCL_MAN1}) + set_source_files_properties(${man} PROPERTIES GENERATED TRUE) get_filename_component(tclman1 ${man} NAME) if (NOT CMAKE_CONFIGURATION_TYPES) configure_file(${man} ${CMAKE_BINARY_DIR}/${MAN_DIR}/man1/${tclman1} COPYONLY) @@ -269,6 +270,7 @@ FILE(GLOB TCL_MAN3 "${CMAKE_CURRENT_BINARY_DIR}/man3/*") foreach(man ${TCL_MAN3}) + set_source_files_properties(${man} PROPERTIES GENERATED TRUE) get_filename_component(tclman3 ${man} NAME) if (NOT CMAKE_CONFIGURATION_TYPES) configure_file(${man} ${CMAKE_BINARY_DIR}/${MAN_DIR}/man3/${tclman3} COPYONLY) @@ -283,6 +285,7 @@ FILE(GLOB TCL_MANN "${CMAKE_CURRENT_BINARY_DIR}/mann/*") foreach(man ${TCL_MANN}) + set_source_files_properties(${man} PROPERTIES GENERATED TRUE) get_filename_component(tclmann ${man} NAME) if (NOT CMAKE_CONFIGURATION_TYPES) configure_file(${man} ${CMAKE_BINARY_DIR}/${MAN_DIR}/mann/${tclmann} COPYONLY) Modified: brlcad/trunk/src/other/tk/doc/CMakeLists.txt =================================================================== --- brlcad/trunk/src/other/tk/doc/CMakeLists.txt 2012-04-03 22:43:02 UTC (rev 49904) +++ brlcad/trunk/src/other/tk/doc/CMakeLists.txt 2012-04-04 05:30:19 UTC (rev 49905) @@ -222,6 +222,7 @@ IF(TKMAN_GENERATED) FILE(GLOB TK_MAN1 "${CMAKE_CURRENT_BINARY_DIR}/man1/*") foreach(man ${TK_MAN1}) + set_source_files_properties(${man} PROPERTIES GENERATED TRUE) get_filename_component(tkman1 ${man} NAME) if (NOT CMAKE_CONFIGURATION_TYPES) configure_file(${man} ${CMAKE_BINARY_DIR}/${MAN_DIR}/man1/${tkman1} COPYONLY) @@ -236,6 +237,7 @@ FILE(GLOB TK_MAN3 "${CMAKE_CURRENT_BINARY_DIR}/man3/*") foreach(man ${TK_MAN3}) + set_source_files_properties(${man} PROPERTIES GENERATED TRUE) get_filename_component(tkman3 ${man} NAME) if (NOT CMAKE_CONFIGURATION_TYPES) configure_file(${man} ${CMAKE_BINARY_DIR}/${MAN_DIR}/man3/${tkman3} COPYONLY) @@ -250,6 +252,7 @@ FILE(GLOB TK_MANN "${CMAKE_CURRENT_BINARY_DIR}/mann/*") foreach(man ${TK_MANN}) + set_source_files_properties(${man} PROPERTIES GENERATED TRUE) get_filename_component(tkmann ${man} NAME) if (NOT CMAKE_CONFIGURATION_TYPES) configure_file(${man} ${CMAKE_BINARY_DIR}/${MAN_DIR}/mann/${tkmann} COPYONLY) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |