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