[cmake-developers] Patch for new warning caused by CMP0054
Ben Boeckel
ben.boeckel at kitware.com
Wed Nov 19 11:05:48 EST 2014
On Tue, Nov 18, 2014 at 23:18:20 +0000, Fraser Hutchison wrote:
> -if(CMAKE_C_SIMULATE_ID STREQUAL "MSVC"
> - OR CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC"
> - OR CMAKE_Fortran_SIMULATE_ID STREQUAL "MSVC"
> - OR CMAKE_C_COMPILER_ID STREQUAL "MSVC"
> - OR CMAKE_CXX_COMPILER_ID STREQUAL "MSVC"
> +if(CMAKE_C_SIMULATE_ID STREQUAL MSVC
> + OR CMAKE_CXX_SIMULATE_ID STREQUAL MSVC
> + OR CMAKE_Fortran_SIMULATE_ID STREQUAL MSVC
> + OR CMAKE_C_COMPILER_ID STREQUAL MSVC
> + OR CMAKE_CXX_COMPILER_ID STREQUAL MSVC
I think you misinterpreted the warning message. It is saying that with
OLD behavior MSVC will be dereferenced (which is bad here because we
want to use it as a string) and with NEW behavior, MSVC is just a string
(and a change in behavior, hence the warning). Given:
CMAKE_CXX_SIMULATE_ID -> MSVC
MSVC -> 1
This now does:
"MSVC" STREQUAL "1"
In fact, this is what CMake will do with CMP0054 set to OLD *anyways*
and these are actual bugs (and always have been; the dequoting of the
left side was done by me in a massive sweep, but the right side issue
was missed). These should be changed to:
"x${var}" STREQUAL "xMSVC"
Though, an easier fix may be to push_scope() and set CMP0054 to NEW in
these files.
--Ben
More information about the cmake-developers
mailing list