diff options
author | Gerald Combs <gerald@wireshark.org> | 2015-04-08 17:36:35 -0700 |
---|---|---|
committer | Graham Bloice <graham.bloice@trihedral.com> | 2015-04-10 09:33:56 +0000 |
commit | 38d3e063d3fb3d007e61b5e8681372c247171218 (patch) | |
tree | 8f1144bed808884091e834bd593640692a9fb0ff /CMakeLists.txt | |
parent | 8c0f09e5b7c86939fec32cfee9085adeb794dfb0 (diff) |
CMake: Add a build environment == generator check.
If we're building on Windows and %Platform% is "x64" or undefined,
check it against our generator's target platform.
Update the "${CMAKE_GENERATOR} MATCHES" regexes to match what CMake
uses internally.
Change-Id: I33996344978855cbdf7c1ee9e55b7340efea5b5c
Reviewed-on: https://code.wireshark.org/review/7994
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 8c4bc807df..cc37acdbdf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,17 +37,31 @@ cmake_policy(SET CMP0015 NEW) # %WIRESHARK_TARGET_PLATFORM%. if(WIN32) - if("${CMAKE_GENERATOR}" MATCHES ".*Win64$") + if("${CMAKE_GENERATOR}" MATCHES "Win64") set(WIRESHARK_TARGET_PLATFORM win64) set(PROCESSOR_ARCHITECTURE amd64) message("Building for x64") - elseif("${CMAKE_GENERATOR}" MATCHES "Visual Studio.*") + elseif("${CMAKE_GENERATOR}" MATCHES "Visual Studio") set(WIRESHARK_TARGET_PLATFORM win32) set(PROCESSOR_ARCHITECTURE x86) message("Building for x86") else() set(WIRESHARK_TARGET_PLATFORM $ENV{WIRESHARK_TARGET_PLATFORM}) endif() + + if(DEFINED ENV{PLATFORM}) + string(TOLOWER $ENV{PLATFORM} _vs_platform) + else() + set(_vs_platform "[undefined]") # x86 + endif() + if( + (_vs_platform STREQUAL "x64" AND NOT WIRESHARK_TARGET_PLATFORM STREQUAL "win64") + OR + (_vs_platform STREQUAL "[undefined]" AND NOT WIRESHARK_TARGET_PLATFORM STREQUAL "win32") + ) + message(FATAL_ERROR "The PLATFORM environment variable (${_vs_platform})" + " doesn't match the generator platform (${WIRESHARK_TARGET_PLATFORM})") + endif() endif(WIN32) #Where to find local cmake scripts |