2019-05-12 22:20:56 +02:00
|
|
|
cmake_minimum_required(VERSION 3.9)
|
|
|
|
|
|
2019-06-21 14:40:34 +02:00
|
|
|
## Add paths to check for cmake modules:
|
|
|
|
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
2019-06-21 13:10:21 +02:00
|
|
|
|
2019-06-21 14:40:34 +02:00
|
|
|
include(FeatureSummary)
|
|
|
|
|
include(QtCreatorIDEBranding)
|
2019-05-12 22:20:56 +02:00
|
|
|
|
|
|
|
|
set(IDE_REVISION FALSE CACHE BOOL "Marks the presence of IDE revision string.")
|
|
|
|
|
set(IDE_REVISION_STR "" CACHE STRING "The IDE revision string.")
|
|
|
|
|
|
2019-06-21 13:10:21 +02:00
|
|
|
mark_as_advanced(IDE_REVISION IDE_REVISION_STR)
|
2019-05-12 22:20:56 +02:00
|
|
|
|
|
|
|
|
project(QtCreator VERSION ${IDE_VERSION})
|
|
|
|
|
|
|
|
|
|
# Force C++ standard, do not fall back, do not use compiler extensions
|
|
|
|
|
set(CMAKE_CXX_STANDARD 14)
|
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
|
|
|
|
|
|
option(WITH_TESTS "Build Tests" OFF)
|
|
|
|
|
option(WITH_DEBUG_CMAKE "Enabled CMake project debugging functionality (e.g. source file disk checking)" OFF)
|
|
|
|
|
|
|
|
|
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
|
|
|
|
|
|
|
|
# Set up Qt stuff:
|
|
|
|
|
set(CMAKE_AUTOMOC ON)
|
|
|
|
|
set(CMAKE_AUTORCC ON)
|
|
|
|
|
set(CMAKE_AUTOUIC ON)
|
|
|
|
|
|
|
|
|
|
if (WITH_TESTS)
|
|
|
|
|
set(_TEST_QT_COMPONENT Test)
|
|
|
|
|
set(_TEST_DEPENDS Qt5::Test)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
find_package(Qt5
|
|
|
|
|
COMPONENTS Concurrent Core Network PrintSupport Qml Quick QuickWidgets
|
2019-06-03 13:23:10 +02:00
|
|
|
Sql ${_TEST_QT_COMPONENT}
|
2019-05-12 22:20:56 +02:00
|
|
|
REQUIRED
|
|
|
|
|
)
|
|
|
|
|
|
2019-06-03 10:30:31 +02:00
|
|
|
find_package(Threads)
|
|
|
|
|
|
2019-05-16 15:31:36 +02:00
|
|
|
# Get information on directories from qmake
|
|
|
|
|
# as this is not yet exported by cmake.
|
|
|
|
|
function(qt5_query_qmake)
|
|
|
|
|
if (NOT TARGET Qt5::qmake)
|
|
|
|
|
message(FATAL_ERROR "Qmake was not found.")
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
get_target_property(_qmake_binary Qt5::qmake IMPORTED_LOCATION)
|
|
|
|
|
execute_process(COMMAND "${_qmake_binary}" "-query"
|
|
|
|
|
TIMEOUT 10
|
|
|
|
|
RESULT_VARIABLE _qmake_result
|
|
|
|
|
OUTPUT_VARIABLE _qmake_stdout
|
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
|
|
|
|
|
|
if (NOT "${_qmake_result}" STREQUAL "0")
|
|
|
|
|
message(FATAL_ERROR "Qmake did not execute successfully: ${_qmake_result}.")
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
# split into lines:
|
|
|
|
|
string(REPLACE "\n" ";" _lines "${_qmake_stdout}")
|
|
|
|
|
|
|
|
|
|
foreach(_line ${_lines})
|
|
|
|
|
# split line into key/value pairs
|
|
|
|
|
string(REPLACE ":" ";" _parts "${_line}")
|
|
|
|
|
list(GET _parts 0 _key)
|
|
|
|
|
list(REMOVE_AT _parts 0)
|
|
|
|
|
string(REPLACE ";" ":" _value "${_parts}")
|
|
|
|
|
|
|
|
|
|
set("${_key}" "${_value}" CACHE PATH "qmake import of ${_key}" FORCE)
|
|
|
|
|
endforeach()
|
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
|
|
qt5_query_qmake()
|
|
|
|
|
|
2019-06-03 13:23:10 +02:00
|
|
|
find_package(Qt5 COMPONENTS Designer Help Script SerialPort Svg QUIET)
|
2019-05-12 22:20:56 +02:00
|
|
|
function (set_if_target var target)
|
|
|
|
|
if (TARGET "${target}")
|
|
|
|
|
set(_result ON)
|
|
|
|
|
else()
|
|
|
|
|
set(_result OFF)
|
|
|
|
|
endif()
|
|
|
|
|
set(${var} "${_result}" PARENT_SCOPE)
|
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
|
|
set_if_target(_has_svg_target Qt5::Svg)
|
|
|
|
|
option(ENABLE_SVG_SUPPORT "Enable SVG support" "${_has_svg_target}")
|
|
|
|
|
|
|
|
|
|
add_library(OptionalSvg INTERFACE)
|
|
|
|
|
if (TARGET Qt5::Svg AND ENABLE_SVG_SUPPORT)
|
|
|
|
|
target_link_libraries(OptionalSvg INTERFACE Qt5::Svg)
|
|
|
|
|
else()
|
|
|
|
|
target_compile_definitions(OptionalSvg INTERFACE QT_NO_SVG)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
find_package(LLVM QUIET)
|
|
|
|
|
find_package(Clang COMPONENTS libclang QUIET)
|
|
|
|
|
|
2019-05-24 09:49:24 +02:00
|
|
|
if (APPLE)
|
|
|
|
|
find_library(FWCoreFoundation CoreFoundation)
|
2019-05-24 12:31:19 +02:00
|
|
|
find_library(FWCoreServices CoreServices)
|
2019-05-24 09:49:24 +02:00
|
|
|
find_library(FWFoundation Foundation)
|
|
|
|
|
find_library(FWAppKit AppKit)
|
|
|
|
|
find_library(FWIOKit IOKit)
|
2019-05-24 12:31:19 +02:00
|
|
|
find_library(FWSecurity Security)
|
|
|
|
|
find_library(FWSystemConfiguration SystemConfiguration)
|
2019-05-24 09:49:24 +02:00
|
|
|
find_library(FWWebKit WebKit)
|
|
|
|
|
endif()
|
|
|
|
|
|
2019-05-12 22:20:56 +02:00
|
|
|
set(_IDE_APP_PATH "bin")
|
|
|
|
|
|
|
|
|
|
if (APPLE)
|
2019-06-21 14:40:34 +02:00
|
|
|
set(_IDE_APP_TARGET "${IDE_DISPLAY_NAME}")
|
2019-05-12 22:20:56 +02:00
|
|
|
|
|
|
|
|
set(_IDE_OUTPUT_PATH "${_IDE_APP_PATH}/${_IDE_APP_TARGET}.app/Contents")
|
|
|
|
|
|
|
|
|
|
set(_IDE_PLUGIN_PATH "${_IDE_OUTPUT_PATH}/PlugIns")
|
|
|
|
|
set(_IDE_LIBRARY_BASE_PATH "Frameworks")
|
|
|
|
|
set(_IDE_LIBRARY_PATH "${_IDE_OUTPUT_PATH}/Frameworks")
|
|
|
|
|
set(_IDE_LIBEXEC_PATH "${_IDE_OUTPUT_PATH}/Resources")
|
|
|
|
|
set(_IDE_DATA_PATH "${_IDE_OUTPUT_PATH}/Resources")
|
|
|
|
|
set(_IDE_DOC_PATH "${_IDE_OUTPUT_PATH}/Resources/doc")
|
|
|
|
|
set(_IDE_BIN_PATH "${_IDE_OUTPUT_PATH}/MacOS")
|
|
|
|
|
else ()
|
2019-06-21 14:40:34 +02:00
|
|
|
set(_IDE_APP_TARGET "${IDE_ID}")
|
2019-05-12 22:20:56 +02:00
|
|
|
|
|
|
|
|
set(_IDE_LIBRARY_BASE_PATH "lib")
|
|
|
|
|
set(_IDE_LIBRARY_PATH "lib/qtcreator")
|
|
|
|
|
set(_IDE_PLUGIN_PATH "lib/qtcreator/plugins")
|
|
|
|
|
if (WIN32)
|
|
|
|
|
set(_IDE_LIBEXEC_PATH "bin")
|
|
|
|
|
else ()
|
|
|
|
|
set(_IDE_LIBEXEC_PATH "libexec/qtcreator/bin")
|
|
|
|
|
endif ()
|
|
|
|
|
set(_IDE_DATA_PATH "share/qtcreator")
|
|
|
|
|
set(_IDE_DOC_PATH "share/doc/qtcreator")
|
|
|
|
|
set(_IDE_BIN_PATH "bin")
|
|
|
|
|
endif ()
|
|
|
|
|
|
2019-06-21 13:10:21 +02:00
|
|
|
set(IDE_APP_PATH "${_IDE_APP_PATH}") # The target path of the IDE application (relative to CMAKE_INSTALL_PREFIX).
|
|
|
|
|
set(IDE_APP_TARGET "${_IDE_APP_TARGET}") # The IDE application name.
|
|
|
|
|
set(IDE_PLUGIN_PATH "${_IDE_PLUGIN_PATH}") # The IDE plugin path (relative to CMAKE_INSTALL_PREFIX).
|
|
|
|
|
set(IDE_LIBRARY_BASE_PATH "${_IDE_LIBRARY_BASE_PATH}") # The IDE library base path (relative to CMAKE_INSTALL_PREFIX).
|
|
|
|
|
set(IDE_LIBRARY_PATH "${_IDE_LIBRARY_PATH}") # The IDE library path (relative to CMAKE_INSTALL_PREFIX).
|
|
|
|
|
set(IDE_LIBEXEC_PATH "${_IDE_LIBEXEC_PATH}") # The IDE libexec path (relative to CMAKE_INSTALL_PREFIX).
|
|
|
|
|
set(IDE_DATA_PATH "${_IDE_DATA_PATH}") # The IDE data path (relative to CMAKE_INSTALL_PREFIX).
|
|
|
|
|
set(IDE_DOC_PATH "${_IDE_DOC_PATH}") # The IDE documentation path (relative to CMAKE_INSTALL_PREFIX).
|
|
|
|
|
set(IDE_BIN_PATH "${_IDE_BIN_PATH}") # The IDE bin path (relative to CMAKE_INSTALL_PREFIX).
|
2019-05-12 22:20:56 +02:00
|
|
|
|
|
|
|
|
file(RELATIVE_PATH RELATIVE_PLUGIN_PATH "/${IDE_BIN_PATH}" "/${IDE_PLUGIN_PATH}")
|
|
|
|
|
file(RELATIVE_PATH RELATIVE_LIBEXEC_PATH "/${IDE_BIN_PATH}" "/${IDE_LIBEXEC_PATH}")
|
|
|
|
|
file(RELATIVE_PATH RELATIVE_DATA_PATH "/${IDE_BIN_PATH}" "/${IDE_DATA_PATH}")
|
|
|
|
|
file(RELATIVE_PATH RELATIVE_DOC_PATH "/${IDE_BIN_PATH}" "/${IDE_DOC_PATH}")
|
|
|
|
|
|
|
|
|
|
list(APPEND DEFAULT_DEFINES
|
|
|
|
|
RELATIVE_PLUGIN_PATH="${RELATIVE_PLUGIN_PATH}"
|
|
|
|
|
RELATIVE_LIBEXEC_PATH="${RELATIVE_LIBEXEC_PATH}"
|
|
|
|
|
RELATIVE_DATA_PATH="${RELATIVE_DATA_PATH}"
|
|
|
|
|
RELATIVE_DOC_PATH="${RELATIVE_DOC_PATH}"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
file(RELATIVE_PATH _PLUGIN_TO_LIB "/${IDE_PLUGIN_PATH}" "/${IDE_LIBRARY_PATH}")
|
|
|
|
|
|
|
|
|
|
if (APPLE)
|
|
|
|
|
set(_RPATH_BASE "@executable_path")
|
|
|
|
|
set(_LIB_RPATH "@loader_path")
|
|
|
|
|
set(_PLUGIN_RPATH "@loader_path;@loader_path/${_PLUGIN_TO_LIB}")
|
|
|
|
|
elseif (WIN32)
|
|
|
|
|
set(_RPATH_BASE "")
|
|
|
|
|
set(_LIB_RPATH "")
|
|
|
|
|
set(_PLUGIN_RPATH "")
|
|
|
|
|
else()
|
|
|
|
|
set(_RPATH_BASE "\$ORIGIN")
|
|
|
|
|
set(_LIB_RPATH "\$ORIGIN")
|
|
|
|
|
set(_PLUGIN_RPATH "\$ORIGIN;\$ORIGIN/${_PLUGIN_TO_LIB}")
|
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
|
|
if (UNIX)
|
|
|
|
|
add_subdirectory(bin)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
add_subdirectory(src)
|
|
|
|
|
add_subdirectory(share)
|
|
|
|
|
|
|
|
|
|
if (WITH_TESTS)
|
|
|
|
|
enable_testing()
|
|
|
|
|
add_subdirectory(tests)
|
|
|
|
|
endif()
|
|
|
|
|
|
2019-05-16 16:17:59 +02:00
|
|
|
add_subdirectory(doc)
|
|
|
|
|
|
2019-05-12 22:20:56 +02:00
|
|
|
feature_summary(INCLUDE_QUIET_PACKAGES WHAT
|
|
|
|
|
PACKAGES_FOUND PACKAGES_NOT_FOUND
|
|
|
|
|
ENABLED_FEATURES DISABLED_FEATURES
|
|
|
|
|
)
|