summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorGraham Bloice <graham.bloice@trihedral.com>2015-04-30 15:00:29 +0100
committerGraham Bloice <graham.bloice@trihedral.com>2015-04-30 15:18:16 +0000
commite00312360e437853cbd06fa75075e530a792901e (patch)
treea09271ba30847de84dcde42594da576ec5eb574f /CMakeLists.txt
parent6af14c2979d074e33bb5bdd135c0d751e7b7e8e0 (diff)
downloadwireshark-e00312360e437853cbd06fa75075e530a792901e.tar.gz
CMake for Windows improvements
Allow the wireshark libs directory to be defined by WIRESHARK_LIB_DIR. Ensure either WIRESHARK_LIB_DIR or WIRESHARK_BASE_DIR is defined. Ensure the compiler is a supported version (VS2010, 12 or 13). Change-Id: I0abd371c5773c08ca255abe308d1a59e2e290a02 Reviewed-on: https://code.wireshark.org/review/8247 Petri-Dish: Graham Bloice <graham.bloice@trihedral.com> 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.txt23
1 files changed, 15 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1a8f525286..4aa0ae2c54 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -86,15 +86,29 @@ if(WIN32)
endif()
message(STATUS "Building for ${WIRESHARK_TARGET_PLATFORM} using ${CMAKE_GENERATOR}")
+ # Determine where the 3rd party libraries will be
+ if( DEFINED ENV{WIRESHARK_LIB_DIR} )
+ # The buildbots set WIRESHARK_LIB_DIR but not WIRESHARK_BASE_DIR.
+ file( TO_CMAKE_PATH "$ENV{WIRESHARK_LIB_DIR}" _PROJECT_LIB_DIR )
+ elseif( DEFINED ENV{WIRESHARK_BASE_DIR} )
+ file( TO_CMAKE_PATH "$ENV{WIRESHARK_BASE_DIR}" _WS_BASE_DIR )
+ set( _PROJECT_LIB_DIR "${_WS_BASE_DIR}/wireshark-${WIRESHARK_TARGET_PLATFORM}-libs" )
+ else()
+ # Don't know what to do
+ message(FATAL_ERROR "Neither WIRESHARK_BASE_DIR or WIRESHARK_LIB_DIR are defined")
+ endif()
+
# Download third-party libraries
file (TO_NATIVE_PATH ${CMAKE_SOURCE_DIR}/tools/win-setup.ps1 _win_setup)
- file (TO_NATIVE_PATH "$ENV{WIRESHARK_BASE_DIR}/wireshark-${WIRESHARK_TARGET_PLATFORM}-libs" _ws_lib_dir)
+ file (TO_NATIVE_PATH ${_PROJECT_LIB_DIR} _ws_lib_dir)
if(MSVC12)
set(_vsversion_args "12")
elseif(MSVC11)
set(_vsversion_args "11")
elseif(MSVC10)
set(_vsversion_args "10")
+ else()
+ message(FATAL_ERROR "Unsupported compiler ${CMAKE_C_COMPILER}")
endif()
# Is it possible to have a one-time, non-cached option in CMake? If
@@ -679,13 +693,6 @@ endif()
if(ENABLE_ZLIB)
if (WIN32)
# On Windows we build our own version of zlib, so add the paths
- if( DEFINED ENV{WIRESHARK_LIB_DIR} )
- # The buildbots set WIRESHARK_LIB_DIR but not WIRESHARK_BASE_DIR.
- file( TO_CMAKE_PATH "$ENV{WIRESHARK_LIB_DIR}" _PROJECT_LIB_DIR )
- else()
- file( TO_CMAKE_PATH "$ENV{WIRESHARK_BASE_DIR}" _WS_BASE_DIR )
- set( _PROJECT_LIB_DIR "${_WS_BASE_DIR}/wireshark-${WIRESHARK_TARGET_PLATFORM}-libs" )
- endif()
set(ZLIB_SRC_DIR "${_PROJECT_LIB_DIR}/zlib-1.2.8")
add_subdirectory("${ZLIB_SRC_DIR}" "${CMAKE_BINARY_DIR}/zlib")
set(ZLIB_INCLUDE_DIR "${ZLIB_SRC_DIR}" "${CMAKE_BINARY_DIR}/zlib")