Skip to content

Instantly share code, notes, and snippets.

@Squareys
Last active May 25, 2017 13:55
Show Gist options
  • Save Squareys/bbe8f4fbc096d9e02e544a75cfdf973c to your computer and use it in GitHub Desktop.
Save Squareys/bbe8f4fbc096d9e02e544a75cfdf973c to your computer and use it in GitHub Desktop.
Corrade Clang-Windows diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0bc3686..c60b7ef 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -139,6 +139,8 @@ if(CORRADE_TARGET_ANDROID)
set(CORRADE_TESTSUITE_ADB_RUNNER ${PROJECT_SOURCE_DIR}/src/Corrade/TestSuite/AdbRunner.sh)
endif()
+message(STATUS ${CMAKE_CXX_COMPILER_ID})
+
# Detect and auto-enable compiler compatibility
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.7.0")
@@ -150,9 +152,9 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
endif()
endif()
elseif(MSVC)
- if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "19.0")
+ if(MSVC_VERSION LESS 1900)
message(FATAL_ERROR "Compatibility branch of Corrade is needed for use with MSVC < 2015. See the documentation for more information.")
- elseif(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "20.0")
+ elseif(CMAKE_CXX_COMPILER_VERSION LESS 2000)
if(NOT MSVC2015_COMPATIBILITY)
set(MSVC2015_COMPATIBILITY ON)
message(WARNING "MSVC 2015 detected, automatically enabling MSVC2015_COMPATIBILITY. Note that some features may not be available with this compiler.")
diff --git a/modules/UseCorrade.cmake b/modules/UseCorrade.cmake
index bd6e562..de9b0d7 100644
--- a/modules/UseCorrade.cmake
+++ b/modules/UseCorrade.cmake
@@ -65,11 +65,11 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
endif()
elseif(MSVC)
# Don't allow to use compilers older than what compatibility mode allows
- if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "18.0")
+ if(MSVC_VERSION LESS 1800)
message(FATAL_ERROR "Corrade cannot be used with MSVC < 2013")
- elseif(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "19.0" AND NOT CORRADE_MSVC2013_COMPATIBILITY)
+ elseif(MSVC_VERSION LESS 1900 AND NOT CORRADE_MSVC2013_COMPATIBILITY)
message(FATAL_ERROR "To use Corrade with MSVC 2013, build it with MSVC2013_COMPATIBILITY enabled")
- elseif(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "20.0" AND NOT CORRADE_MSVC2015_COMPATIBILITY)
+ elseif(MSVC_VERSION LESS 2000 AND NOT CORRADE_MSVC2015_COMPATIBILITY)
message(FATAL_ERROR "To use Corrade with MSVC 2015, build it with MSVC2015_COMPATIBILITY enabled")
endif()
endif()
//////////////////////////////////////////////////////////// package/ci/appveyor-clang-cl.bat
call "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/vcvarsall.bat" || exit /b
rem Build
mkdir build && cd build || exit /b
cmake .. ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_INSTALL_PREFIX=%APPVEYOR_BUILD_FOLDER%/install ^
-DUTILITY_USE_ANSI_COLORS=%ANSI_COLORS% ^
-DBUILD_TESTS=ON ^
-DCMAKE_CXX_COMPILER=clang-cl
-DCMAKE_C_COMPILER=clang-cl
-G Ninja || exit /b
cmake --build . || exit /b
cmake --build . --target install || exit /b
set PATH=%APPVEYOR_BUILD_FOLDER%/install/bin;%PATH%
rem Test
cd %APPVEYOR_BUILD_FOLDER%/build || exit /b
ctest -V || exit /b
rem Examples
cd %APPVEYOR_BUILD_FOLDER% || exit /b
mkdir build-examples && cd build-examples || exit /b
cmake ../src/examples ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_PREFIX_PATH=%APPVEYOR_BUILD_FOLDER%/install ^
-DCMAKE_CXX_COMPILER=clang-cl
-DCMAKE_C_COMPILER=clang-cl
-G Ninja || exit /b
cmake --build . || exit /b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment