[CMake] Duplicate attempts to find software during cmake stage
authormcatanzaro@igalia.com <mcatanzaro@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Jan 2016 01:23:08 +0000 (01:23 +0000)
committermcatanzaro@igalia.com <mcatanzaro@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Jan 2016 01:23:08 +0000 (01:23 +0000)
https://bugs.webkit.org/show_bug.cgi?id=153211

Reviewed by Martin Robinson.

* CMakeLists.txt: Remove duplication of commands in WebKitCommon.cmake.
* Source/cmake/WebKitCommon.cmake: Guard the entire file so it runs only once.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@195242 268f45cc-cd09-0410-ab3c-d52691b4dbfc

CMakeLists.txt
ChangeLog
Source/cmake/WebKitCommon.cmake

index cfa4cc2..7a62c67 100644 (file)
@@ -16,11 +16,6 @@ if (NOT DEFINED ENABLE_TOOLS AND EXISTS "${CMAKE_SOURCE_DIR}/Tools")
     set(ENABLE_TOOLS ON)
 endif ()
 
-include(WebKitMacros)
-include(WebKitFS)
-include(WebKitHelpers)
-include(WebKitFeatures)
-
 # -----------------------------------------------------------------------------
 # Determine which port will be built
 # -----------------------------------------------------------------------------
@@ -110,19 +105,18 @@ set(WebCoreTestSupport_LIBRARY_TYPE STATIC)
 option(SHOULD_INSTALL_JS_SHELL "generate an installation rule to install the built JavaScript shell")
 
 # -----------------------------------------------------------------------------
-# Common options
+# Common configuration
+#------------------------------------------------------------------------------
+include(WebKitCommon)
+
+# -----------------------------------------------------------------------------
+# Output directories
 #------------------------------------------------------------------------------
-include(OptionsCommon)
 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
 
 # -----------------------------------------------------------------------------
-# Port-specific options
-# -----------------------------------------------------------------------------
-include(Options${PORT})
-
-# -----------------------------------------------------------------------------
 # Enable API unit tests and create a target for the test runner
 # -----------------------------------------------------------------------------
 if (ENABLE_API_TESTS)
@@ -150,8 +144,3 @@ endif ()
 # Print the features list last, for maximum visibility.
 # -----------------------------------------------------------------------------
 PRINT_WEBKIT_OPTIONS()
-
-# -----------------------------------------------------------------------------
-# Create the configuration header
-# -----------------------------------------------------------------------------
-CREATE_CONFIGURATION_HEADER()
index 82ec37a..1db2a9a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2016-01-18  Michael Catanzaro  <mcatanzaro@igalia.com>
+
+        [CMake] Duplicate attempts to find software during cmake stage
+        https://bugs.webkit.org/show_bug.cgi?id=153211
+
+        Reviewed by Martin Robinson.
+
+        * CMakeLists.txt: Remove duplication of commands in WebKitCommon.cmake.
+        * Source/cmake/WebKitCommon.cmake: Guard the entire file so it runs only once.
+
 2016-01-17  Michael Catanzaro  <mcatanzaro@igalia.com>
 
         [CMake] Do not build bmalloc when USE_SYSTEM_MALLOC is ON
index 8ca1785..e617c7c 100644 (file)
@@ -1,37 +1,54 @@
 # -----------------------------------------------------------------------------
-# Find common packages (used by all ports)
+# This file is included individually from various subdirectories (JSC, WTF,
+# WebCore, WebKit) in order to allow scripts to build only part of WebKit.
+# We want to run this file only once.
 # -----------------------------------------------------------------------------
-if (WIN32)
-    list(APPEND CMAKE_PROGRAM_PATH $ENV{SystemDrive}/cygwin/bin)
+if (NOT HAS_RUN_WEBKIT_COMMON)
+    set(HAS_RUN_WEBKIT_COMMON TRUE)
+
+    # -----------------------------------------------------------------------------
+    # Find common packages (used by all ports)
+    # -----------------------------------------------------------------------------
+    if (WIN32)
+        list(APPEND CMAKE_PROGRAM_PATH $ENV{SystemDrive}/cygwin/bin)
+    endif ()
+
+    find_package(BISON 2.1 REQUIRED)
+    if (!APPLE)
+        find_package(FLEX 2.5.34 REQUIRED)
+    endif ()
+
+    # TODO Enforce version requirement for gperf
+    find_package(Gperf 3.0.1 REQUIRED)
+
+    # TODO Enforce version requirement for perl
+    find_package(Perl 5.10.0 REQUIRED)
+
+    find_package(PythonInterp 2.7.0 REQUIRED)
+
+    # We cannot check for RUBY_FOUND because it is set only when the full package is installed and
+    # the only thing we need is the interpreter. Unlike Python, cmake does not provide a macro
+    # for finding only the Ruby interpreter.
+    find_package(Ruby 1.9)
+    if (NOT RUBY_EXECUTABLE OR RUBY_VERSION VERSION_LESS 1.9)
+        message(FATAL_ERROR "Ruby 1.9 or higher is required.")
+    endif ()
+
+    # -----------------------------------------------------------------------------
+    # Helper macros and feature defines
+    # -----------------------------------------------------------------------------
+
+    include(WebKitMacros)
+    include(WebKitFS)
+    include(WebKitHelpers)
+    include(WebKitFeatures)
+
+    include(OptionsCommon)
+    include(Options${PORT})
+
+    # -----------------------------------------------------------------------------
+    # config.h
+    # -----------------------------------------------------------------------------
+
+    CREATE_CONFIGURATION_HEADER()
 endif ()
-
-find_package(BISON 2.1 REQUIRED)
-if (!APPLE)
-    find_package(FLEX 2.5.34 REQUIRED)
-endif ()
-
-# TODO Enforce version requirement for gperf
-find_package(Gperf 3.0.1 REQUIRED)
-
-# TODO Enforce version requirement for perl
-find_package(Perl 5.10.0 REQUIRED)
-
-find_package(PythonInterp 2.7.0 REQUIRED)
-
-# We cannot check for RUBY_FOUND because it is set only when the full package is installed and
-# the only thing we need is the interpreter. Unlike Python, cmake does not provide a macro
-# for finding only the Ruby interpreter.
-find_package(Ruby 1.9)
-if (NOT RUBY_EXECUTABLE OR RUBY_VERSION VERSION_LESS 1.9)
-    message(FATAL_ERROR "Ruby 1.9 or higher is required.")
-endif ()
-
-include(WebKitMacros)
-include(WebKitFS)
-include(WebKitHelpers)
-include(WebKitFeatures)
-
-include(OptionsCommon)
-include(Options${PORT})
-
-CREATE_CONFIGURATION_HEADER()