summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoerg Mayer <jmayer@loplof.de>2014-09-18 08:05:48 +0200
committerJörg Mayer <jmayer@loplof.de>2014-09-18 07:02:00 +0000
commit3b46e6eaf61a29f9bd8f8c162caa54cc2ea81fe2 (patch)
tree529bfa2bd7e8a0da4b95b392efa9c8a834e04789
parent84629f43cb6c19ca2e0e512ac2429584925be896 (diff)
downloadwireshark-3b46e6eaf61a29f9bd8f8c162caa54cc2ea81fe2.tar.gz
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>
-rw-r--r--CMakeLists.txt4
-rw-r--r--CMakeListsCustom.txt.example (renamed from plugins/CMakeListsCustom.txt)2
-rw-r--r--cmake/modules/UseCustomIncludes.cmake20
-rw-r--r--epan/CMakeLists.txt2
-rw-r--r--epan/CMakeListsCustom.txt.example (renamed from epan/CMakeListsCustom.txt)0
-rw-r--r--ui/gtk/CMakeLists.txt2
-rw-r--r--ui/gtk/CMakeListsCustom.txt.example (renamed from ui/gtk/CMakeListsCustom.txt)0
7 files changed, 26 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d546a05b07..712d895866 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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}")
diff --git a/plugins/CMakeListsCustom.txt b/CMakeListsCustom.txt.example
index f9cd0fbf83..92d28b6c6d 100644
--- a/plugins/CMakeListsCustom.txt
+++ b/CMakeListsCustom.txt.example
@@ -25,4 +25,4 @@ set(CUSTOM_PLUGIN_SRC_DIR
# private_plugins/foo
# or
# plugins/foo
-) \ No newline at end of file
+)
diff --git a/cmake/modules/UseCustomIncludes.cmake b/cmake/modules/UseCustomIncludes.cmake
new file mode 100644
index 0000000000..15e93f7043
--- /dev/null
+++ b/cmake/modules/UseCustomIncludes.cmake
@@ -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()
diff --git a/epan/CMakeLists.txt b/epan/CMakeLists.txt
index 657129aefa..5b7ff43c03 100644
--- a/epan/CMakeLists.txt
+++ b/epan/CMakeLists.txt
@@ -21,7 +21,7 @@
include(UseABICheck)
-include(CMakeListsCustom.txt)
+ADD_CUSTOM_CMAKE_INCLUDE()
if (HAVE_HFI_SECTION_INIT)
add_definitions(
diff --git a/epan/CMakeListsCustom.txt b/epan/CMakeListsCustom.txt.example
index d1f41d62ab..d1f41d62ab 100644
--- a/epan/CMakeListsCustom.txt
+++ b/epan/CMakeListsCustom.txt.example
diff --git a/ui/gtk/CMakeLists.txt b/ui/gtk/CMakeLists.txt
index 3b5600445e..13878c7770 100644
--- a/ui/gtk/CMakeLists.txt
+++ b/ui/gtk/CMakeLists.txt
@@ -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
diff --git a/ui/gtk/CMakeListsCustom.txt b/ui/gtk/CMakeListsCustom.txt.example
index 57ff1b7a02..57ff1b7a02 100644
--- a/ui/gtk/CMakeListsCustom.txt
+++ b/ui/gtk/CMakeListsCustom.txt.example