Do not set CMAKE_BUILD_TYPE if it is not defined
[WebKit-https.git] / Source / cmake / OptionsCommon.cmake
index a1d918e..0acbcfc 100644 (file)
@@ -1,20 +1,37 @@
-ADD_DEFINITIONS(-DBUILDING_WITH_CMAKE=1)
-ADD_DEFINITIONS(-DHAVE_CONFIG_H=1)
+add_definitions(-DBUILDING_WITH_CMAKE=1)
+add_definitions(-DHAVE_CONFIG_H=1)
 
-IF (WTF_OS_UNIX)
-    ADD_DEFINITIONS(-DXP_UNIX)
-ENDIF (WTF_OS_UNIX)
+if (WTF_OS_UNIX)
+    add_definitions(-DXP_UNIX)
+endif (WTF_OS_UNIX)
 
-IF (MSVC)
+# CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS only matters with GCC >= 4.7.0.  Since this
+# version, -P does not output empty lines, which currently breaks make_names.pl in
+# WebCore. Investigating whether make_names.pl should be changed instead is left as an exercise to
+# the reader.
+if (MSVC)
     # FIXME: Some codegenerators don't support paths with spaces. So use the executable name only.
-    GET_FILENAME_COMPONENT(CODE_GENERATOR_PREPROCESSOR_EXECUTABLE ${CMAKE_CXX_COMPILER} NAME)
-    SET(CODE_GENERATOR_PREPROCESSOR "${CODE_GENERATOR_PREPROCESSOR_EXECUTABLE} /nologo /EP")
-ELSEIF (CMAKE_SYSTEM_NAME MATCHES QNX)
-    SET(CODE_GENERATOR_PREPROCESSOR "${CMAKE_CXX_COMPILER} -E -Wp,-P -x c++")
-ELSE ()
-    SET(CODE_GENERATOR_PREPROCESSOR "${CMAKE_CXX_COMPILER} -E -P -x c++")
-ENDIF ()
+    get_filename_component(CODE_GENERATOR_PREPROCESSOR_EXECUTABLE ${CMAKE_CXX_COMPILER} NAME)
+    set(CODE_GENERATOR_PREPROCESSOR "${CODE_GENERATOR_PREPROCESSOR_EXECUTABLE} /nologo /EP")
+    set(CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS "${CODE_GENERATOR_PREPROCESSOR}")
+elseif (CMAKE_SYSTEM_NAME MATCHES QNX)
+    set(CODE_GENERATOR_PREPROCESSOR "${CMAKE_CXX_COMPILER} -E -Wp,-P -x c++")
+    set(CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS "${CODE_GENERATOR_PREPROCESSOR}")
+else ()
+    set(CODE_GENERATOR_PREPROCESSOR "${CMAKE_CXX_COMPILER} -E -P -x c++")
+    set(CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS "${CMAKE_CXX_COMPILER} -E -x c++")
+endif ()
 
-SET(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)")
+set_property(GLOBAL PROPERTY USE_FOLDERS ON)
 
-SET(LIB_INSTALL_DIR "lib${LIB_SUFFIX}" CACHE PATH "Where to install libraries (lib${LIB_SUFFIX})")
+string(TOLOWER ${CMAKE_HOST_SYSTEM_PROCESSOR} LOWERCASE_CMAKE_HOST_SYSTEM_PROCESSOR)
+if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND "${LOWERCASE_CMAKE_HOST_SYSTEM_PROCESSOR}" MATCHES "(i[3-6]86|x86)")
+    # To avoid out of memory when building with debug option in 32bit system.
+    # See https://bugs.webkit.org/show_bug.cgi?id=77327
+    set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "-Wl,--no-keep-memory ${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
+endif ()
+
+set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)")
+
+set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}" CACHE PATH "Where to install libraries (lib${LIB_SUFFIX})")
+set(EXEC_INSTALL_DIR "bin" CACHE PATH "Where to install executables")