Bill Hoffman wrote:
The only work around that I can think of is to change the macro to a function and unset the variable before the test.

function(foo bar)
  set(${bar} )  # unset the variable named "${bar}"
  if("${bar}" MATCHES "CFLAGS")
    message(STATUS "CFLAGS matched")
  elseif("${bar}" STREQUAL "CFLAGS")
    message(STATUS "CFLAGS match broken!!!")
  endif()
endfunction()

I should add: this doesn't work (at least, not nicely and without fiddling with PARENT_SCOPE), since I need to change another (function-local) variable based on the value of ${bar}.

After thinking about it a bit more, this bit of autotools-inspired hackery seems to suffice: 'if("!${bar}" MATCHES "!CFLAGS")'. Except I think I found another bug (stay tuned) :-).

--
Matthew
Please do not quote my e-mail address unobfuscated in message bodies.
--
C++ is for people who want to be able to not just shoot themselves in the foot, but do it with a rocket launcher. -- Igor Peshansky

_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to