Do not set CMAKE_BUILD_TYPE if it is not defined
[WebKit-https.git] / Source / cmake / OptionsCommon.cmake
1 add_definitions(-DBUILDING_WITH_CMAKE=1)
2 add_definitions(-DHAVE_CONFIG_H=1)
3
4 if (WTF_OS_UNIX)
5     add_definitions(-DXP_UNIX)
6 endif (WTF_OS_UNIX)
7
8 # CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS only matters with GCC >= 4.7.0.  Since this
9 # version, -P does not output empty lines, which currently breaks make_names.pl in
10 # WebCore. Investigating whether make_names.pl should be changed instead is left as an exercise to
11 # the reader.
12 if (MSVC)
13     # FIXME: Some codegenerators don't support paths with spaces. So use the executable name only.
14     get_filename_component(CODE_GENERATOR_PREPROCESSOR_EXECUTABLE ${CMAKE_CXX_COMPILER} NAME)
15     set(CODE_GENERATOR_PREPROCESSOR "${CODE_GENERATOR_PREPROCESSOR_EXECUTABLE} /nologo /EP")
16     set(CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS "${CODE_GENERATOR_PREPROCESSOR}")
17 elseif (CMAKE_SYSTEM_NAME MATCHES QNX)
18     set(CODE_GENERATOR_PREPROCESSOR "${CMAKE_CXX_COMPILER} -E -Wp,-P -x c++")
19     set(CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS "${CODE_GENERATOR_PREPROCESSOR}")
20 else ()
21     set(CODE_GENERATOR_PREPROCESSOR "${CMAKE_CXX_COMPILER} -E -P -x c++")
22     set(CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS "${CMAKE_CXX_COMPILER} -E -x c++")
23 endif ()
24
25 set_property(GLOBAL PROPERTY USE_FOLDERS ON)
26
27 string(TOLOWER ${CMAKE_HOST_SYSTEM_PROCESSOR} LOWERCASE_CMAKE_HOST_SYSTEM_PROCESSOR)
28 if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND "${LOWERCASE_CMAKE_HOST_SYSTEM_PROCESSOR}" MATCHES "(i[3-6]86|x86)")
29     # To avoid out of memory when building with debug option in 32bit system.
30     # See https://bugs.webkit.org/show_bug.cgi?id=77327
31     set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "-Wl,--no-keep-memory ${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
32 endif ()
33
34 set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)")
35
36 set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}" CACHE PATH "Where to install libraries (lib${LIB_SUFFIX})")
37 set(EXEC_INSTALL_DIR "bin" CACHE PATH "Where to install executables")