aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2019-01-17 19:34:37 +0100
committerPeter Wu <peter@lekensteyn.nl>2019-01-17 22:28:14 +0000
commit17cdfe9d775f9ff927a78d5509011984a0acf017 (patch)
treedf1d1d7a2fba26f34574c240bdf6cca8fcfb41e9 /CMakeLists.txt
parentcbe7f26a86c2d24e3525bdea9faa3b2b307d8c95 (diff)
CMake: silence CMP0083 warning from future CMake 3.14
The current development version of CMake started emitting warnings due to the use of CMAKE_POSITION_INDEPENDENT_CODE without setting CMP0083. Change-Id: Id6747c00fea7a1d28e5ba900ba4578fe89f40f83 Reviewed-on: https://code.wireshark.org/review/31579 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt21
1 files changed, 13 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b1b5d82f53..e5e52fac02 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -13,6 +13,9 @@ if(WIN32)
else()
cmake_minimum_required(VERSION 3.5)
endif()
+if(POLICY CMP0083)
+ cmake_policy(SET CMP0083 NEW)
+endif()
project(Wireshark C CXX)
# Updated by tools/make-version.pl
@@ -332,11 +335,8 @@ endif()
# Always enable position-independent code when compiling, even for
# executables, so you can build position-independent executables.
-# -pie is added below for non-MSVC.
-# Needed when either:
-# - Qt5_POSITION_INDEPENDENT_CODE is set and CMake < 2.8.11
-# - PIE is wanted (-pie) and you want to add -fPIC/-fPIE automatically.
-# This option only has an effect on CMake >= 2.8.9
+# -pie is added below for non-MSVC, but requires objects to be built with
+# -fPIC/-fPIE (so set CMAKE_POSITION_INDEPENDENT_CODE to enable that).
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# Path to our generated executables (or wrapper scripts)
@@ -883,9 +883,14 @@ if(NOT CMAKE_C_COMPILER_ID MATCHES "MSVC" AND NOT OSS_FUZZ)
# independent may fail, the user can set CMAKE_EXE_LINKER_FLAGS=-no-pie
# as a workaround.
#
- check_c_linker_flag(-pie LINK_pie_VALID)
- if(LINK_pie_VALID)
- set(CMAKE_EXE_LINKER_FLAGS "-pie ${CMAKE_EXE_LINKER_FLAGS}")
+ if(CMAKE_VERSION VERSION_GREATER "3.13.999")
+ include(CheckPIESupported)
+ check_pie_supported()
+ else()
+ check_c_linker_flag(-pie LINK_pie_VALID)
+ if(LINK_pie_VALID)
+ set(CMAKE_EXE_LINKER_FLAGS "-pie ${CMAKE_EXE_LINKER_FLAGS}")
+ endif()
endif()
endif()