The following issue has been SUBMITTED. ====================================================================== http://public.kitware.com/Bug/view.php?id=15335 ====================================================================== Reported By: Brian Chojnowski Assigned To: ====================================================================== Project: CMake Issue ID: 15335 Category: CMake Reproducibility: always Severity: major Priority: normal Status: new ====================================================================== Date Submitted: 2015-01-04 21:19 EST Last Modified: 2015-01-04 21:19 EST ====================================================================== Summary: if () evaluates to FALSE for quoted constants/variables where the contents are non-null and not defined constants Description: An if statement should evaluate to TRUE if the variable is not-null and is not a defined false constant.
>From the documentation: if(<constant>) True if the constant is 1, ON, YES, TRUE, Y, or a non-zero number. False if the constant is 0, OFF, NO, FALSE, N, IGNORE, NOTFOUND, the empty string, or ends in the suffix -NOTFOUND. Named boolean constants are case-insensitive. If the argument is not one of these constants, it is treated as a variable. if(<variable>) True if the variable is defined to a value that is not a false constant. False otherwise. (Note macro arguments are not variables.) Steps to Reproduce: set(myvar "not a false constant") message(STATUS "myvar=${myvar}") if(myvar) message(STATUS "un quoted variable name = TRUE") endif() if(${myvar}) message(STATUS "un quoted variable contents = TRUE") endif() if("${myvar}") message(STATUS "quoted variable = TRUE") endif() Output: Eclipse version is set to 4.4 (). Adjust CMAKE_ECLIPSE_VERSION if this is wrong. myvar=test string un quoted variable name = TRUE Configuring done ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 2015-01-04 21:19 Brian ChojnowskiNew Issue ====================================================================== -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers