Different reaction of IF (<> STREQUAL <>) operator or varios platforms
If I launch this sample on Linux:
message(CMAKE_CXX_COMPILER_ID = ${CMAKE_CXX_COMPILER_ID})
if (${CMAKE_CXX_COMPILER_ID} STREQUAL GNU)
message(---1---)
endif()
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
message(---2---)
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
message(---3---)
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL GNU)
message(---4---)
endif()
I get output:
CMAKE_CXX_COMPILER_ID=GNU
---1---
---2---
---3---
---4---
I expected the same reaction on Windows:
message(CMAKE_CXX_COMPILER_ID = ${CMAKE_CXX_COMPILER_ID})
if (${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC)
message(---1---)
endif()
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
message(---2---)
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
message(---3---)
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL MSVC)
message(---4---)
endif()\
but this is output:
CMAKE_CXX_COMPILER_ID=MSVC
---1---
---3---
What is the problem?