From: <rus...@us...> - 2008-03-30 06:29:08
|
Revision: 110 http://gearbox.svn.sourceforge.net/gearbox/?rev=110&view=rev Author: russo2503v Date: 2008-03-29 23:29:09 -0700 (Sat, 29 Mar 2008) Log Message: ----------- added function to listing all enable options Modified Paths: -------------- gearbox/trunk/cmake/DependencyUtils.cmake gearbox/trunk/cmake/SetupDirectories.cmake gearbox/trunk/cmake/TargetUtils.cmake gearbox/trunk/cmake/internal/Setup.cmake gearbox/trunk/doc/buildsys.dox gearbox/trunk/doc/install_debian.dox Modified: gearbox/trunk/cmake/DependencyUtils.cmake =================================================================== --- gearbox/trunk/cmake/DependencyUtils.cmake 2008-03-26 02:32:57 UTC (rev 109) +++ gearbox/trunk/cmake/DependencyUtils.cmake 2008-03-30 06:29:09 UTC (rev 110) @@ -1,3 +1,6 @@ +# +# utility macro +# MACRO( GBX_MAKE_OPTION_NAME option_name module_type module_name ) STRING( COMPARE EQUAL ${module_type} "EXE" is_exe ) @@ -68,6 +71,14 @@ OPTION( ${option_name} "Try to build lib${module_name} library" ${default_option_value} ) ENDIF( is_exe ) + # add option to the list: this has nothing to do with the build system. + # it is useful to have a text list of all options if you want to build a particular + # configuration from the command line. + SET( templist ${OPTION_LIST} ) + # (escaping \) + LIST( APPEND templist "${option_name}=${default_option_value}" ) + SET( OPTION_LIST ${templist} CACHE INTERNAL "Global list of cmake options" FORCE ) + # must dereference both var and option names once (!) and IF will evaluate their values IF( ${cumulative_var} AND NOT ${option_name} ) SET( ${cumulative_var} FALSE ) @@ -227,3 +238,24 @@ ENDFOREACH( trgt ${ARGN} ) ENDMACRO( GBX_REQUIRE_TARGETS cumulative_var module_type module_name ) + +# +# This is a utility macro for internal use. +# +MACRO( GBX_WRITE_OPTIONS ) + SET( output_file ${GBX_PROJECT_BINARY_DIR}/${PROJECT_NAME}_options.cmake ) + WRITE_FILE( ${output_file} "\# Autogenerated by CMake for ${PROJECT_NAME} project" ) + + FOREACH( a ${OPTION_LIST} ) + WRITE_FILE( ${output_file} "-D${a} \\" APPEND ) + ENDFOREACH( a ${LIB_LIST} ) +ENDMACRO( GBX_WRITE_OPTIONS ) + +# +# This is a utility macro for internal use. +# Reset global lists of components, libraries, etc. +# +MACRO( GBX_RESET_ALL_DEPENDENCY_LISTS ) + # MESSAGE( STATUS "DEBUG: Resetting global dependency lists" ) + SET( OPTION_LIST "" CACHE INTERNAL "Global list of cmake options" FORCE ) +ENDMACRO( GBX_RESET_ALL_DEPENDENCY_LISTS ) Modified: gearbox/trunk/cmake/SetupDirectories.cmake =================================================================== --- gearbox/trunk/cmake/SetupDirectories.cmake 2008-03-26 02:32:57 UTC (rev 109) +++ gearbox/trunk/cmake/SetupDirectories.cmake 2008-03-30 06:29:09 UTC (rev 110) @@ -2,15 +2,15 @@ # Installation directory is determined by looking at 3 sources of information in the following order, # later sources overwrite earlier ones: # 1. OS-dependent defaults (effective only the first time CMake runs or after CMakeCache is deleted) -# 2. Enviroment variable whose name is held in variable project_install_var -# 3. CMake variable whose name is held in project_install_var. +# 2. Enviroment variable whose name is determined as <PROJECT_NAME>_INSTALL +# 3. CMake variable whose name is determined as <PROJECT_NAME>_INSTALL (same as the environment variable) # -# E.g. -# - rm CMakeCache.txt; cmake . -# /opt/orca-1.2.3 -# - export HYDRO_INSTALL=/home/myname; cmake . -# /home/myname -# - export HYDRO_INSTALL=/home/myname; cmake -DHYDRO_INSTALL=/home/myname/opt. +# E.g. in Linux, for a project called 'fruitcake' +# $ rm CMakeCache.txt; cmake . +# /usr/local/ +# $ export FRUITCAKE_INSTALL=/home/myname/install; cmake . +# /home/myname/install +# $ export FRUITCAKE_INSTALL=/home/myname/install; cmake -DFRUITCAKE_INSTALL=/home/myname/opt . # /home/myname/opt # # Afterwards, it's ok to just use "cmake .", the previously set installation dir is held in cache. Modified: gearbox/trunk/cmake/TargetUtils.cmake =================================================================== --- gearbox/trunk/cmake/TargetUtils.cmake 2008-03-26 02:32:57 UTC (rev 109) +++ gearbox/trunk/cmake/TargetUtils.cmake 2008-03-30 06:29:09 UTC (rev 110) @@ -1,7 +1,7 @@ # -# Components should add themselves by calling 'GBX_ADD_EXECUTABLE' +# Executables should add themselves by calling 'GBX_ADD_EXECUTABLE' # instead of 'ADD_EXECUTABLE' in CMakeLists.txt. -# Usage: GBX_ADD_EXECUTABLE( name src1 src2 src3 ) +# Usage is the same as ADD_EXECUTABLE, all parameters are passed to ADD_EXECUTABLE. # MACRO( GBX_ADD_EXECUTABLE name ) ADD_EXECUTABLE( ${name} ${ARGN} ) @@ -9,17 +9,17 @@ # INSTALL_RPATH "${INSTALL_RPATH};${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME}" # BUILD_WITH_INSTALL_RPATH TRUE ) INSTALL( TARGETS ${name} RUNTIME DESTINATION bin ) - SET( templist ${COMPONENT_LIST} ) + SET( templist ${EXE_LIST} ) LIST( APPEND templist ${name} ) # MESSAGE( STATUS "DEBUG: ${templist}" ) - SET( COMPONENT_LIST ${templist} CACHE INTERNAL "Global list of components to build" FORCE ) + SET( EXE_LIST ${templist} CACHE INTERNAL "Global list of executables to build" FORCE ) MESSAGE( STATUS "Planning to Build Executable: ${name}" ) ENDMACRO( GBX_ADD_EXECUTABLE name ) # -# Components should add themselves by calling 'GBX_ADD_EXECUTABLE' +# Libraries should add themselves by calling 'GBX_ADD_LIBRARY' # instead of 'ADD_LIBRARY' in CMakeLists.txt. -# Usage: GBX_ADD_LIBRARY( name src1 src2 src3 ) +# Usage is the same as ADD_LIBRARY, all parameters are passed to ADD_LIBRARY. # MACRO( GBX_ADD_LIBRARY name ) ADD_LIBRARY( ${name} ${ARGN} ) @@ -27,9 +27,9 @@ # INSTALL_RPATH "${INSTALL_RPATH};${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME}" # BUILD_WITH_INSTALL_RPATH TRUE ) INSTALL( TARGETS ${name} LIBRARY DESTINATION lib/${PROJECT_NAME} ) - SET( templist ${LIBRARY_LIST} ) + SET( templist ${LIB_LIST} ) LIST( APPEND templist ${name} ) - SET( LIBRARY_LIST ${templist} CACHE INTERNAL "Global list of libraries to build" FORCE ) + SET( LIB_LIST ${templist} CACHE INTERNAL "Global list of libraries to build" FORCE ) MESSAGE( STATUS "Planning to Build Library : ${name}" ) ENDMACRO( GBX_ADD_LIBRARY name ) @@ -96,7 +96,7 @@ # # This is a mechanism to register special items which are not -# components or libraries. This function only records the name of +# executables or libraries. This function only records the name of # the item to display it at the end of the cmake run and to submit # to the Dashboard. # Usage: GBX_ADD_ITEM( name ) @@ -151,10 +151,10 @@ # Usage: GBX_NOT_ADD_EXECUTABLE( name reason ) # MACRO( GBX_NOT_ADD_EXECUTABLE name reason ) - SET( templist ${COMPONENT_NOT_LIST} ) + SET( templist ${EXE_NOT_LIST} ) LIST( APPEND templist ${name} ) # MESSAGE( STATUS "DEBUG: ${templist}" ) - SET( COMPONENT_NOT_LIST ${templist} CACHE INTERNAL "Global list of components NOT to build" FORCE ) + SET( EXE_NOT_LIST ${templist} CACHE INTERNAL "Global list of executables NOT to build" FORCE ) MESSAGE( STATUS "Not planning to Build Executable : ${name} because ${reason}" ) ENDMACRO( GBX_NOT_ADD_EXECUTABLE name reason ) @@ -162,22 +162,23 @@ # Usage: GBX_NOT_ADD_LIBRARY( name reason ) # MACRO( GBX_NOT_ADD_LIBRARY name reason ) - SET( templist ${LIBRARY_NOT_LIST} ) + SET( templist ${LIB_NOT_LIST} ) LIST( APPEND templist ${name} ) # MESSAGE( STATUS "DEBUG: ${templist}" ) - SET( LIBRARY_NOT_LIST ${templist} CACHE INTERNAL "Global list of libraries NOT to build" FORCE ) + SET( LIB_NOT_LIST ${templist} CACHE INTERNAL "Global list of libraries NOT to build" FORCE ) MESSAGE( STATUS "Not planning to Build Library : ${name} because ${reason}" ) ENDMACRO( GBX_NOT_ADD_LIBRARY name reason ) # +# This is a utility macro for internal use. # Prints out list information: size, and items. # Prints nothing if list is empty. -# Example: LIST_REPORT( COMPONENT_LIST "component(s)" ) +# Example: LIST_REPORT( EXE_LIST "executable(s)" ) # # Tricky list stuff. # see http://www.cmake.org/Wiki/CMakeMacroMerge for an example # -MACRO( LIST_REPORT ACTION ITEM_NAME note L ) +MACRO( LIST_REPORT action item_name note L ) SET( templist ${L} ) LIST( LENGTH templist templist_length ) SET( report_file ${GBX_PROJECT_BINARY_DIR}/cmake_config_report.txt ) @@ -185,15 +186,16 @@ IF( templist_length GREATER 0 ) LIST( SORT templist ) - MESSAGE( STATUS "${ACTION} ${templist_length} ${ITEM_NAME} ${note}:" ) + MESSAGE( STATUS "${action} ${templist_length} ${item_name} ${note}:" ) MESSAGE( STATUS " ${templist}" ) - WRITE_FILE( ${report_file} "${ACTION} ${templist_length} ${ITEM_NAME}:" APPEND ) + WRITE_FILE( ${report_file} "${action} ${templist_length} ${item_name}:" APPEND ) WRITE_FILE( ${report_file} " ${templist}" APPEND ) ENDIF( templist_length GREATER 0 ) -ENDMACRO( LIST_REPORT ACTION ITEM_NAME note L ) +ENDMACRO( LIST_REPORT action item_name note L ) # +# This is a utility macro for internal use. # Puts messages on the screen. # Writes to a text file. # @@ -222,37 +224,40 @@ MESSAGE( STATUS "Install dir ${CMAKE_INSTALL_PREFIX}") SET( note " " ) - LIST_REPORT( "Will build" "executables" ${note} "${COMPONENT_LIST}" ) - LIST_REPORT( "Will build" "libraries" ${note} "${LIBRARY_LIST}" ) + LIST_REPORT( "Will build" "executables" ${note} "${EXE_LIST}" ) + LIST_REPORT( "Will build" "libraries" ${note} "${LIB_LIST}" ) LIST_REPORT( "Will build" "CTest tests" ${note} "${TEST_LIST}" ) LIST_REPORT( "Will build" "special items" ${note} "${ITEM_LIST}" ) SET( note "(see above for reasons)" ) - LIST_REPORT( "Will NOT build" "executables" ${note} "${COMPONENT_NOT_LIST}" ) - LIST_REPORT( "Will NOT build" "libraries" ${note} "${LIBRARY_NOT_LIST}" ) + LIST_REPORT( "Will NOT build" "executables" ${note} "${EXE_NOT_LIST}" ) + LIST_REPORT( "Will NOT build" "libraries" ${note} "${LIB_NOT_LIST}" ) ENDMACRO( GBX_CONFIG_REPORT ) +# +# This is a utility macro for internal use. +# MACRO( GBX_WRITE_MANIFEST ) - SET( manifest_file ${GBX_PROJECT_BINARY_DIR}/${PROJECT_NAME}_manifest.cmake ) - WRITE_FILE( ${manifest_file} "\# Autogenerated by CMake for ${PROJECT_NAME} project" ) + SET( output_file ${GBX_PROJECT_BINARY_DIR}/${PROJECT_NAME}_manifest.cmake ) + WRITE_FILE( ${output_file} "\# Autogenerated by CMake for ${PROJECT_NAME} project" ) - FOREACH( A ${LIBRARY_LIST} ) + FOREACH( A ${LIB_LIST} ) STRING( TOUPPER ${A} UPPERA ) - WRITE_FILE( ${manifest_file} "SET( ${UPPERA}_INSTALLED 1)" APPEND ) - ENDFOREACH( A ${LIBRARY_LIST} ) + WRITE_FILE( ${output_file} "SET( ${UPPERA}_INSTALLED 1)" APPEND ) + ENDFOREACH( A ${LIB_LIST} ) - FOREACH( A ${LIBRARY_NOT_LIST} ) + FOREACH( A ${LIB_NOT_LIST} ) STRING( TOUPPER ${A} UPPERA ) - WRITE_FILE( ${manifest_file} "SET( ${UPPERA}_INSTALLED 0)" APPEND ) - ENDFOREACH( A ${LIBRARY_NOT_LIST} ) + WRITE_FILE( ${output_file} "SET( ${UPPERA}_INSTALLED 0)" APPEND ) + ENDFOREACH( A ${LIB_NOT_LIST} ) - WRITE_FILE( ${manifest_file} " " APPEND ) + WRITE_FILE( ${output_file} " " APPEND ) STRING( TOUPPER ${PROJECT_NAME} upper_project_name ) - WRITE_FILE( ${manifest_file} "SET( ${upper_project_name}_MANIFEST_LOADED 1)" APPEND ) + WRITE_FILE( ${output_file} "SET( ${upper_project_name}_MANIFEST_LOADED 1)" APPEND ) - INSTALL( FILES ${manifest_file} DESTINATION . ) + INSTALL( FILES ${output_file} DESTINATION . ) ENDMACRO( GBX_WRITE_MANIFEST ) MACRO( GBX_WRITE_LICENSE ) @@ -269,17 +274,18 @@ ENDMACRO( GBX_WRITE_LICENSE ) # +# This is a utility macro for internal use. # Reset global lists of components, libraries, etc. # -MACRO( GBX_RESET_ALL_LISTS ) - # MESSAGE( STATUS "DEBUG: Resetting global component and library lists" ) - SET( COMPONENT_LIST "" CACHE INTERNAL "Global list of components to build" FORCE ) - SET( LIBRARY_LIST "" CACHE INTERNAL "Global list of libraries to build" FORCE ) - SET( TEST_LIST "" CACHE INTERNAL "Global list of CTest tests to build" FORCE ) - SET( ITEM_LIST "" CACHE INTERNAL "Global list of special items to build" FORCE ) +MACRO( GBX_RESET_ALL_TARGET_LISTS ) + # MESSAGE( STATUS "DEBUG: Resetting global target lists" ) + SET( EXE_LIST "" CACHE INTERNAL "Global list of executables to build" FORCE ) + SET( LIB_LIST "" CACHE INTERNAL "Global list of libraries to build" FORCE ) + SET( TEST_LIST "" CACHE INTERNAL "Global list of CTest tests to build" FORCE ) + SET( ITEM_LIST "" CACHE INTERNAL "Global list of special items to build" FORCE ) - SET( COMPONENT_NOT_LIST "" CACHE INTERNAL "Global list of components NOT to build" FORCE ) - SET( LIBRARY_NOT_LIST "" CACHE INTERNAL "Global list of libraries NOT to build" FORCE ) + SET( EXE_NOT_LIST "" CACHE INTERNAL "Global list of executables NOT to build" FORCE ) + SET( LIB_NOT_LIST "" CACHE INTERNAL "Global list of libraries NOT to build" FORCE ) - SET( LICENSE_LIST "" CACHE INTERNAL "Global list of directories and their licenses" FORCE ) -ENDMACRO( GBX_RESET_ALL_LISTS ) + SET( LICENSE_LIST "" CACHE INTERNAL "Global list of directories and their licenses" FORCE ) +ENDMACRO( GBX_RESET_ALL_TARGET_LISTS ) Modified: gearbox/trunk/cmake/internal/Setup.cmake =================================================================== --- gearbox/trunk/cmake/internal/Setup.cmake 2008-03-26 02:32:57 UTC (rev 109) +++ gearbox/trunk/cmake/internal/Setup.cmake 2008-03-30 06:29:09 UTC (rev 110) @@ -90,9 +90,10 @@ ADD_SUBDIRECTORY( cmake ) # -# Print results of CMake activity +# Write results of CMake activity to file # GBX_WRITE_MANIFEST() +GBX_WRITE_OPTIONS() # # Print license information to a file @@ -101,9 +102,13 @@ GBX_WRITE_LICENSE() ENDIF( GBX_BUILD_LICENSE ) +# +# Print results of CMake activity +# GBX_CONFIG_REPORT( "Nothing special" ) # -# House-keeping, clear lists of targets, licenses, etc. +# House-keeping, clear lists of targets, licenses, options, etc. # -GBX_RESET_ALL_LISTS() +GBX_RESET_ALL_TARGET_LISTS() +GBX_RESET_ALL_DEPENDENCY_LISTS() Modified: gearbox/trunk/doc/buildsys.dox =================================================================== --- gearbox/trunk/doc/buildsys.dox 2008-03-26 02:32:57 UTC (rev 109) +++ gearbox/trunk/doc/buildsys.dox 2008-03-30 06:29:09 UTC (rev 110) @@ -195,8 +195,12 @@ Path variables: @verbatim +GBX_BIN_INSTALL_DIR +GBX_LIB_INSTALL_DIR +GBX_INCLUDE_INSTALL_DIR GBX_PROJECT_BINARY_DIR GBX_PROJECT_SOURCE_DIR +GBX_SHARE_INSTALL_DIR @endverbatim */ Modified: gearbox/trunk/doc/install_debian.dox =================================================================== --- gearbox/trunk/doc/install_debian.dox 2008-03-26 02:32:57 UTC (rev 109) +++ gearbox/trunk/doc/install_debian.dox 2008-03-30 06:29:09 UTC (rev 110) @@ -14,15 +14,11 @@ @note Reviewed for release 0.0.1 -These are detailed instructions for installing GearBox on Debian Linux. They are known to work for a system using Debian \b Testing distribution. See @ref gbx_doc_getting for general guidelines. +These are detailed instructions for installing GearBox on Debian Linux. They are known to work for a system using Debian \b Testing distribution. These instructions should also be applicable to Ubuntu/Kubuntu 6.10 (Edgy). See @ref gbx_doc_getting for general guidelines. -@section gbx_doc_installdebian_ubuntu Ubuntu\Kubuntu - -These instructions should also be applicable to Ubuntu/Kubuntu 6.10 (Edgy). - @section gbx_doc_installdebian_cmake CMake -Minimum version required 2.4-patch 4 (latest tested: 2.4-patch 7). +Minimum version required 2.4-patch 4 (latest tested: 2.4-patch 8). @verbatim # apt-get install cmake @@ -70,17 +66,17 @@ The default installation directory is @c /usr/local. There are two options for specifying a custom install directory: - Option 1. With @c cmake. This variable is stored in CMake cache so you don't have to set this variable every time: only the first time you run cmake and when you want to change it. For example: @verbatim -$ cmake -DCMAKE_INSTALL_PREFIX=$HOME/gearbox . +$ cmake -DGEARBOX_INSTALL=$HOME/gearbox . @endverbatim or @verbatim -$ cmake -DCMAKE_INSTALL_PREFIX=/opt/gearbox-[VERSION] . +$ cmake -DGEARBOX_INSTALL=/opt/gearbox-[VERSION] . @endverbatim - Option 2. If you've changed your mind about the installation directory, you can change it at any time using @c ccmake tool. @verbatim $ ccmake . @endverbatim -Scroll down to @c CMAKE_INSTALL_PREFIX variable, hit ENTER to edit and type in the new installation directory. When finished, hit ENTER again, then type "c" for [c]onfigure and "g" for [g]enerate. From now on, the new installation dir will be used. +Scroll down to @c GEARBOX_INSTALL variable, hit ENTER to edit and type in the new installation directory. When finished, hit ENTER again, then type "c" for [c]onfigure and "g" for [g]enerate. From now on, the new installation dir will be used. That's it! We are done. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |