Having CmakeListsCustom.txt in git defeats the purpose of its existence:

If it is used, there is a modified file in git.
Fix this by only including the file if it exists.
Other changes:
- Rename the existing Custom files to CMakeListsCustom.txt.example.
- Move the plugins custom file to the top level (same level as its
  including parent).
- Optionally allow a list of custom includes instead of the default one.

Change-Id: I8960eac6222f741c045055d43d1d5a2d4979caf6
Reviewed-on: https://code.wireshark.org/review/4163
Reviewed-by: Jörg Mayer <jmayer@loplof.de>
This commit is contained in:
Joerg Mayer 2014-09-18 08:05:48 +02:00 committed by Jörg Mayer
parent 84629f43cb
commit 3b46e6eaf6
7 changed files with 26 additions and 4 deletions

View File

@ -35,6 +35,9 @@ cmake_policy(SET CMP0015 NEW)
#Where to find local cmake scripts
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
include(UseCustomIncludes)
ADD_CUSTOM_CMAKE_INCLUDE()
# This cannot be implemented via option(...)
if( NOT CMAKE_BUILD_TYPE )
set( CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
@ -772,7 +775,6 @@ ADD_CUSTOM_COMMAND(
)
if(ENABLE_PLUGINS)
include(plugins/CMakeListsCustom.txt)
set(HAVE_PLUGINS 1)
set(PLUGIN_DIR "${DATAFILE_DIR}/plugins/${CPACK_PACKAGE_VERSION}")
set(PLUGIN_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/@CPACK_PACKAGE_NAME@/plugins/${CPACK_PACKAGE_VERSION}")

View File

@ -25,4 +25,4 @@ set(CUSTOM_PLUGIN_SRC_DIR
# private_plugins/foo
# or
# plugins/foo
)
)

View File

@ -0,0 +1,20 @@
#
# - Include a custom CMake file relative to the current source directory.
# - If no filename is provided, CMakeListsCustom.txt is used.
#
macro( ADD_CUSTOM_CMAKE_INCLUDE )
if( ${ARGN} )
set( _file_list ${ARGN} )
else()
set( _file_list CMakeListsCustom.txt )
endif()
foreach (_include ${_file_list})
set( _include_file ${CMAKE_CURRENT_SOURCE_DIR}/${_include} )
if( EXISTS ${_include_file} )
message ( STATUS "Including ${_include_file}" )
include( ${_include_file} )
else()
message ( STATUS "No custom file found in ${CMAKE_CURRENT_SOURCE_DIR}" )
endif()
endforeach()
endmacro()

View File

@ -21,7 +21,7 @@
include(UseABICheck)
include(CMakeListsCustom.txt)
ADD_CUSTOM_CMAKE_INCLUDE()
if (HAVE_HFI_SECTION_INIT)
add_definitions(

View File

@ -19,7 +19,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
include(CMakeListsCustom.txt)
ADD_CUSTOM_CMAKE_INCLUDE()
set(WIRESHARK_GTK_SRC
about_dlg.c