Revision: 70082 http://sourceforge.net/p/brlcad/code/70082 Author: starseeker Date: 2017-08-15 20:22:33 +0000 (Tue, 15 Aug 2017) Log Message: ----------- Replace the other use of the auto_options macro
Modified Paths: -------------- brlcad/trunk/CMakeLists.txt brlcad/trunk/misc/CMake/BRLCAD_Options.cmake Modified: brlcad/trunk/CMakeLists.txt =================================================================== --- brlcad/trunk/CMakeLists.txt 2017-08-15 14:05:24 UTC (rev 70081) +++ brlcad/trunk/CMakeLists.txt 2017-08-15 20:22:33 UTC (rev 70082) @@ -1359,11 +1359,15 @@ endif(BRLCAD_ENABLE_STRICT) # Build with compiler optimization flags. This should normally be on for -# release builds. -AUTO_OPTION(BRLCAD_FLAGS_OPTIMIZATION BRLCAD_OPTIMIZED_BUILD "OFF" "ON") -if(CMAKE_CONFIGURATION_TYPES) - mark_as_advanced(BRLCAD_FLAGS_OPTIMIZATION) -endif(CMAKE_CONFIGURATION_TYPES) +# release builds and off otherwise, unless the user specifically enables it. +# For multi-config build tools, this is managed on a per-configuration basis. +if(CMAKE_BUILD_TYPE) + cmake_dependent_option(BRLCAD_OPTIMIZED_BUILD "Enable optimized build flags" ON "${CMAKE_BUILD_TYPE} STREQUAL Release" OFF) +else(CMAKE_BUILD_TYPE) + # Note: the cmake_dependent_option test doesn't work if CMAKE_BUILD_TYPE isn't set. + option(BRLCAD_OPTIMIZED_BUILD "Enable optimized build flags" OFF) +endif(CMAKE_BUILD_TYPE) +mark_as_advanced(BRLCAD_OPTIMIZED_BUILD) # Build with full compiler lines visible by default (won't need make # VERBOSE=1) on command line Modified: brlcad/trunk/misc/CMake/BRLCAD_Options.cmake =================================================================== --- brlcad/trunk/misc/CMake/BRLCAD_Options.cmake 2017-08-15 14:05:24 UTC (rev 70081) +++ brlcad/trunk/misc/CMake/BRLCAD_Options.cmake 2017-08-15 20:22:33 UTC (rev 70082) @@ -31,58 +31,7 @@ # 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. -# -### -#----------------------------------------------------------------------------- -# Build Type aware option -macro(AUTO_OPTION username varname debug_state release_state) - string(LENGTH "${${username}}" ${username}_SET) - if(NOT ${username}_SET) - set(${username} "AUTO" CACHE STRING "auto option" FORCE) - endif(NOT ${username}_SET) - - set_property(CACHE ${username} PROPERTY STRINGS AUTO "ON" "OFF") - - string(TOUPPER "${${username}}" username_upper) - set(${username} ${username_upper}) - - if(NOT ${${username}} MATCHES "AUTO" AND NOT ${${username}} MATCHES "ON" AND NOT ${${username}} MATCHES "OFF") - message(WARNING "Unknown value ${${username}} supplied for ${username} - defaulting to AUTO.\nValid options are AUTO, ON and OFF") - set(${username} "AUTO" CACHE STRING "auto option" FORCE) - endif(NOT ${${username}} MATCHES "AUTO" AND NOT ${${username}} MATCHES "ON" AND NOT ${${username}} MATCHES "OFF") - - # If the "parent" setting isn't AUTO, do what it says - if(NOT ${${username}} MATCHES "AUTO") - set(${varname} ${${username}}) - endif(NOT ${${username}} MATCHES "AUTO") - - # If we don't understand the build type and have an AUTO setting, - # varname is not set. - if(CMAKE_BUILD_TYPE AND NOT "${CMAKE_BUILD_TYPE}" MATCHES "Release" AND NOT "${CMAKE_BUILD_TYPE}" MATCHES "Debug") - if(NOT ${${username}} MATCHES "AUTO") - set(${varname} ${${username}}) - endif(NOT ${${username}} MATCHES "AUTO") - endif(CMAKE_BUILD_TYPE AND NOT "${CMAKE_BUILD_TYPE}" MATCHES "Release" AND NOT "${CMAKE_BUILD_TYPE}" MATCHES "Debug") - - # If we DO understand the build type and have AUTO, be smart - if("${CMAKE_BUILD_TYPE}" MATCHES "Release" AND ${${username}} MATCHES "AUTO") - set(${varname} ${release_state}) - set(${username} "${release_state} (AUTO)" CACHE STRING "auto option" FORCE) - endif("${CMAKE_BUILD_TYPE}" MATCHES "Release" AND ${${username}} MATCHES "AUTO") - - if("${CMAKE_BUILD_TYPE}" MATCHES "Debug" AND ${${username}} MATCHES "AUTO") - set(${varname} ${debug_state}) - set(${username} "${debug_state} (AUTO)" CACHE STRING "auto option" FORCE) - endif("${CMAKE_BUILD_TYPE}" MATCHES "Debug" AND ${${username}} MATCHES "AUTO") - - if(NOT CMAKE_BUILD_TYPE AND ${${username}} MATCHES "AUTO") - set(${varname} ${debug_state}) - set(${username} "${debug_state} (AUTO)" CACHE STRING "auto option" FORCE) - endif(NOT CMAKE_BUILD_TYPE AND ${${username}} MATCHES "AUTO") - -endmacro(AUTO_OPTION varname release_state debug_state) - #----------------------------------------------------------------------------- # For "top-level" BRL-CAD options, some extra work is in order - descriptions and # lists of aliases are supplied, and those are automatically addressed by this 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