diff options
author | Peter Wu <peter@lekensteyn.nl> | 2017-10-14 20:13:52 +0100 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2017-10-16 04:31:57 +0000 |
commit | d3f636ece0ab60e2b8edc8648fa05e83338b60c6 (patch) | |
tree | 0b87b5a19ac81135e89845b08f2b5d8f64eee458 /CMakeLists.txt | |
parent | 282b59a853f95c7bf463b617f8d40949b8f8b3ef (diff) |
cmake: fix CMP0026 deprecation warning in CMake 3.9
Since CMake 3.9, all policies before CMP0036 emit a warning. Fix the
warning by not relying on the old behavior (existence of the LOCATION
property).
Tested with Ninja, the cmake output, rules.ninja and build.ninja output
is identical (minus the deprecation warning).
Change-Id: I058699380b01a9c02d9b98fd485ce6ded427abe3
Reviewed-on: https://code.wireshark.org/review/23915
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 42cfeb207a..06eb0c6709 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,11 +56,6 @@ endif() #Where to find local cmake scripts set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules) -# Set old behaviour for LOCATION property (since 3.0) -if (POLICY CMP0026) - cmake_policy(SET CMP0026 OLD) -endif() - # Set old behaviour for MACOSX_RPATH (since 3.0) if (POLICY CMP0042) cmake_policy(SET CMP0042 OLD) @@ -166,10 +161,9 @@ string(TOUPPER "${CMAKE_BUILD_TYPE}" _build_type) message(STATUS "CMAKE_C_FLAGS_${_build_type}: ${CMAKE_C_FLAGS_${_build_type}}") message(STATUS "CMAKE_CXX_FLAGS_${_build_type}: ${CMAKE_CXX_FLAGS_${_build_type}}") -# Where to put executables and libraries in the build tree -# Note: Executables and libraries might end end up in a configuration -# subdirectory, e.g. run/Debug or run/Release. We try to set DATAFILE_DIR -# to a corresponding value below. +# Ensure that all executables and libraries end up in the same directory. Actual +# files might end up in a configuration subdirectory, e.g. run/Debug or +# run/Release. We try to set DATAFILE_DIR to actual location below. if(NOT ARCHIVE_OUTPUT_PATH) set(ARCHIVE_OUTPUT_PATH ${Wireshark_BINARY_DIR}/run CACHE INTERNAL "Single output directory for building all archives.") @@ -1306,9 +1300,12 @@ add_subdirectory( writecap ) # WIRESHARK_RUN_FROM_BUILD_DIRECTORY is set. if(ENABLE_APPLICATION_BUNDLE) set(_datafile_dir "${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/Resources/share/wireshark") +elseif(NOT CMAKE_CFG_INTDIR STREQUAL ".") + # Visual Studio, Xcode, etc. + set(_datafile_dir "${CMAKE_BINARY_DIR}/run/${CMAKE_CFG_INTDIR}") else() - get_target_property(_libwireshark_location epan LOCATION) - get_filename_component(_datafile_dir "${_libwireshark_location}" PATH) + # Makefile, Ninja, etc. + set(_datafile_dir "${CMAKE_BINARY_DIR}/run") endif() set(DATAFILE_DIR ${_datafile_dir} CACHE INTERNAL "Build time data file location.") @@ -1404,9 +1401,7 @@ endif() if(ENABLE_APPLICATION_BUNDLE) set(_plugin_dir "${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/PlugIns/wireshark/${PROJECT_RELEASE_VERSION}") else() - get_target_property(_libwireshark_location epan LOCATION) - get_filename_component(_plugin_dir "${_libwireshark_location}" PATH) - set(_plugin_dir "${_plugin_dir}/${PLUGIN_VERSION_DIR}") + set(_plugin_dir "${DATAFILE_DIR}/${PLUGIN_VERSION_DIR}") endif() set (PLUGIN_DIR ${_plugin_dir} CACHE INTERNAL "Build time plugin location.") @@ -1712,12 +1707,7 @@ set(LIBEPAN_LIBS ) if(WIN32) - # According to http://stackoverflow.com/questions/14474659/cmake-how-to-have-a-target-for-copying-files - # we can't just use "set(_dll_output_dir "$<TARGET_FILE_DIR:epan>")" - # DATAFILE_DIR is set using the same property. We could probably - # get away with using it here. - get_target_property(_libwireshark_location epan LOCATION) - get_filename_component(_dll_output_dir "${_libwireshark_location}" PATH) + set(_dll_output_dir "${DATAFILE_DIR}") add_custom_target(copy_cli_dlls) set_target_properties(copy_cli_dlls PROPERTIES FOLDER "Copy Tasks") add_custom_command(TARGET copy_cli_dlls PRE_BUILD @@ -2372,8 +2362,6 @@ if(BUILD_wireshark_gtk AND GTK_FOUND) ) if(WIN32) - get_target_property(_wsgtk_location wireshark-gtk LOCATION) - get_filename_component(_dll_output_dir "${_wsgtk_location}" PATH) add_custom_target(copy_gtk_dlls) set_target_properties(copy_gtk_dlls PROPERTIES FOLDER "Copy Tasks") add_custom_command(TARGET copy_gtk_dlls PRE_BUILD |