[CMake] Troubles with macros and STREQUAL
Kyle Edwards
kyle.edwards at kitware.com
Fri May 31 14:51:50 EDT 2019
On Fri, 2019-05-31 at 20:43 +0200, Steven Truppe wrote:
> macro(bsAddLibrary lib)
> # get all WITH_LIB varables
> message(STATUS "${lib}")
>
> get_cmake_property(_variables VARIABLES)
> foreach(_var ${_variables})
>
> -->> (${lib} is "WITH_LIB_GLAD" but allways return false =(
> if(_var STREQUAL ${lib})
Should be:
if(_var STREQUAL lib)
due to how if() expands variable references.
https://cmake.org/cmake/help/v3.14/command/if.html#variable-expansion
Kyle
More information about the CMake
mailing list