How does one achieve the equivalent of the cmake branch below for clang++?
if (GXX_VERSION VERSION_GREATER 4.5 OR GXX_VERSION VERSION_EQUAL 4.5)
...
Thanks,
For some reason piokuc's solution doesn't work for me, so I did the following:
EXECUTE_PROCESS( COMMAND ${CMAKE_CXX_COMPILER} --version OUTPUT_VARIABLE clang_full_version_string )
string (REGEX REPLACE ".*clang version ([0-9]+\\.[0-9]+).*" "\\1" CLANG_VERSION_STRING ${clang_full_version_string})
if (CLANG_VERSION_STRING VERSION_GREATER 3.1)
....
CMake defines following for clang:
This works for me:
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 3.2)
...
...
endif ()
Similarly, we have VERSION_LESS
and VERSION_EQUAL
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With