diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeCCompilerId.c.in | 4 | ||||
-rw-r--r-- | Modules/CMakeCXXCompilerId.cpp.in | 4 | ||||
-rw-r--r-- | Modules/CMakeDetermineASMCompiler.cmake | 2 | ||||
-rw-r--r-- | Modules/CMakeDetermineCCompiler.cmake | 2 | ||||
-rw-r--r-- | Modules/CMakeDetermineCXXCompiler.cmake | 2 | ||||
-rw-r--r-- | Modules/CMakeDetermineCompilerId.cmake | 19 | ||||
-rw-r--r-- | Modules/CMakeDetermineFortranCompiler.cmake | 2 | ||||
-rw-r--r-- | Modules/CMakeDetermineSystem.cmake | 7 | ||||
-rw-r--r-- | Modules/FindQt4.cmake | 579 | ||||
-rw-r--r-- | Modules/GNUInstallDirs.cmake | 64 | ||||
-rw-r--r-- | Modules/Platform/QNX-QCC-C.cmake | 4 | ||||
-rw-r--r-- | Modules/Platform/QNX-QCC-CXX.cmake | 4 | ||||
-rw-r--r-- | Modules/Platform/QNX.cmake | 40 |
13 files changed, 334 insertions, 399 deletions
diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in index d53247a..52f9590 100644 --- a/Modules/CMakeCCompilerId.c.in +++ b/Modules/CMakeCCompilerId.c.in @@ -227,6 +227,10 @@ char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; #endif +#ifdef __QNXNTO__ +char const* qnxnto = "INFO" ":" "qnxnto"; +#endif + @CMAKE_C_COMPILER_ID_PLATFORM_CONTENT@ @CMAKE_C_COMPILER_ID_ERROR_FOR_TEST@ diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in index b5d498d..25ceb3f 100644 --- a/Modules/CMakeCXXCompilerId.cpp.in +++ b/Modules/CMakeCXXCompilerId.cpp.in @@ -220,6 +220,10 @@ char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; #endif +#ifdef __QNXNTO__ +char const* qnxnto = "INFO" ":" "qnxnto"; +#endif + @CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT@ @CMAKE_CXX_COMPILER_ID_ERROR_FOR_TEST@ diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake index 247de6f..ca7eb8b 100644 --- a/Modules/CMakeDetermineASMCompiler.cmake +++ b/Modules/CMakeDetermineASMCompiler.cmake @@ -124,7 +124,7 @@ endif() # e.g. powerpc-linux-gas, arm-elf-gas or i586-mingw32msvc-gas , optionally # with a 3-component version number at the end # The other tools of the toolchain usually have the same prefix -# NAME_WE cannot be used since then this test will fail for names lile +# NAME_WE cannot be used since then this test will fail for names like # "arm-unknown-nto-qnx6.3.0-gas.exe", where BASENAME would be # "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-" if (NOT _CMAKE_TOOLCHAIN_PREFIX) diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index 438a98a..c3f5a66 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -149,7 +149,7 @@ endif () # e.g. powerpc-linux-gcc, arm-elf-gcc or i586-mingw32msvc-gcc, optionally # with a 3-component version number at the end (e.g. arm-eabi-gcc-4.5.2). # The other tools of the toolchain usually have the same prefix -# NAME_WE cannot be used since then this test will fail for names lile +# NAME_WE cannot be used since then this test will fail for names like # "arm-unknown-nto-qnx6.3.0-gcc.exe", where BASENAME would be # "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-" if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX) diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index 5f9d9bf..21864f1 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -145,7 +145,7 @@ endif () # e.g. powerpc-linux-g++, arm-elf-g++ or i586-mingw32msvc-g++ , optionally # with a 3-component version number at the end (e.g. arm-eabi-gcc-4.5.2). # The other tools of the toolchain usually have the same prefix -# NAME_WE cannot be used since then this test will fail for names lile +# NAME_WE cannot be used since then this test will fail for names like # "arm-unknown-nto-qnx6.3.0-gcc.exe", where BASENAME would be # "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-" diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 2bcf3d1..067892d 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -48,6 +48,21 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) CMAKE_DETERMINE_COMPILER_ID_VENDOR(${lang}) endif() + if (COMPILER_QNXNTO AND CMAKE_${lang}_COMPILER_ID STREQUAL GNU) + execute_process( + COMMAND "${CMAKE_${lang}_COMPILER}" + -V + OUTPUT_VARIABLE output ERROR_VARIABLE output + RESULT_VARIABLE result + TIMEOUT 10 + ) + if (output MATCHES "targets available") + set(CMAKE_${lang}_COMPILER_ID QCC) + # http://community.qnx.com/sf/discussion/do/listPosts/projects.community/discussion.qnx_momentics_community_support.topc3555?_pagenum=2 + # The qcc driver does not itself have a version. + endif() + endif() + # if the format is unknown after all files have been checked, put "Unknown" in the cache if(NOT CMAKE_EXECUTABLE_FORMAT) set(CMAKE_EXECUTABLE_FORMAT "Unknown" CACHE INTERNAL "Executable file format") @@ -369,6 +384,9 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) string(REGEX REPLACE "^0+([0-9])" "\\1" SIMULATE_VERSION "${SIMULATE_VERSION}") string(REGEX REPLACE "\\.0+([0-9])" ".\\1" SIMULATE_VERSION "${SIMULATE_VERSION}") endif() + if("${info}" MATCHES ".*INFO:qnxnto") + set(COMPILER_QNXNTO 1) + endif() endforeach() # Detect the exact architecture from the PE header. @@ -459,6 +477,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) set(CMAKE_${lang}_SIMULATE_ID "${CMAKE_${lang}_SIMULATE_ID}" PARENT_SCOPE) set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_${lang}_SIMULATE_VERSION}" PARENT_SCOPE) set(CMAKE_EXECUTABLE_FORMAT "${CMAKE_EXECUTABLE_FORMAT}" PARENT_SCOPE) + set(COMPILER_QNXNTO "${COMPILER_QNXNTO}" PARENT_SCOPE) endfunction() #----------------------------------------------------------------------------- diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index 8e2065d..4c8a8f2 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -193,7 +193,7 @@ endif () # e.g. powerpc-linux-gfortran, arm-elf-gfortran or i586-mingw32msvc-gfortran , optionally # with a 3-component version number at the end (e.g. arm-eabi-gcc-4.5.2). # The other tools of the toolchain usually have the same prefix -# NAME_WE cannot be used since then this test will fail for names lile +# NAME_WE cannot be used since then this test will fail for names like # "arm-unknown-nto-qnx6.3.0-gcc.exe", where BASENAME would be # "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-" if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX) diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake index 7756273..f1bad99 100644 --- a/Modules/CMakeDetermineSystem.cmake +++ b/Modules/CMakeDetermineSystem.cmake @@ -47,9 +47,14 @@ if(CMAKE_HOST_UNIX) if(CMAKE_UNAME) exec_program(uname ARGS -s OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_NAME) exec_program(uname ARGS -r OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION) - if(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|CYGWIN.*") + if(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|CYGWIN.*|Darwin") exec_program(uname ARGS -m OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR RETURN_VALUE val) + if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin" AND + CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "Power Macintosh") + # OS X ppc 'uname -m' may report 'Power Macintosh' instead of 'powerpc' + set(CMAKE_HOST_SYSTEM_PROCESSOR "powerpc") + endif() elseif(CMAKE_HOST_SYSTEM_NAME MATCHES "OpenBSD") exec_program(arch ARGS -s OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR RETURN_VALUE val) diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index 9be4270..0bf2b99 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -1,109 +1,118 @@ #.rst: # FindQt4 -# ------- +# ******* # -# Find Qt 4 +# Finding and Using Qt4 +# ===================== # # This module can be used to find Qt4. The most important issue is that # the Qt4 qmake is available via the system path. This qmake is then # used to detect basically everything else. This module defines a -# number of key variables and macros. The variable QT_USE_FILE is set -# which is the path to a CMake file that can be included to compile Qt 4 -# applications and libraries. It sets up the compilation environment -# for include directories, preprocessor defines and populates a -# QT_LIBRARIES variable. +# number of :prop_tgt:`IMPORTED` targets, macros and variables. # # Typical usage could be something like: # -# :: +# .. code-block:: cmake # -# find_package(Qt4 4.4.3 REQUIRED QtCore QtGui QtXml) -# include(${QT_USE_FILE}) +# set(CMAKE_AUTOMOC ON) +# set(CMAKE_INCLUDE_CURRENT_DIR ON) +# find_package(Qt4 4.4.3 REQUIRED QtGui QtXml) # add_executable(myexe main.cpp) -# target_link_libraries(myexe ${QT_LIBRARIES}) -# -# -# -# The minimum required version can be specified using the standard -# find_package()-syntax (see example above). For compatibility with -# older versions of FindQt4.cmake it is also possible to set the -# variable QT_MIN_VERSION to the minimum required version of Qt4 before -# the find_package(Qt4) command. If both are used, the version used in -# the find_package() command overrides the one from QT_MIN_VERSION. -# -# When using the components argument, QT_USE_QT* variables are -# automatically set for the QT_USE_FILE to pick up. If one wishes to -# manually set them, the available ones to set include: -# -# :: -# -# QT_DONT_USE_QTCORE -# QT_DONT_USE_QTGUI -# QT_USE_QT3SUPPORT -# QT_USE_QTASSISTANT -# QT_USE_QAXCONTAINER -# QT_USE_QAXSERVER -# QT_USE_QTDESIGNER -# QT_USE_QTMOTIF -# QT_USE_QTMAIN -# QT_USE_QTMULTIMEDIA -# QT_USE_QTNETWORK -# QT_USE_QTNSPLUGIN -# QT_USE_QTOPENGL -# QT_USE_QTSQL -# QT_USE_QTXML -# QT_USE_QTSVG -# QT_USE_QTTEST -# QT_USE_QTUITOOLS -# QT_USE_QTDBUS -# QT_USE_QTSCRIPT -# QT_USE_QTASSISTANTCLIENT -# QT_USE_QTHELP -# QT_USE_QTWEBKIT -# QT_USE_QTXMLPATTERNS -# QT_USE_PHONON -# QT_USE_QTSCRIPTTOOLS -# QT_USE_QTDECLARATIVE -# -# -# -# :: -# -# QT_USE_IMPORTED_TARGETS -# If this variable is set to TRUE, FindQt4.cmake will create imported -# library targets for the various Qt libraries and set the -# library variables like QT_QTCORE_LIBRARY to point at these imported -# targets instead of the library file on disk. This provides much better -# handling of the release and debug versions of the Qt libraries and is -# also always backwards compatible, except for the case that dependencies -# of libraries are exported, these will then also list the names of the -# imported targets as dependency and not the file location on disk. This -# is much more flexible, but requires that FindQt4.cmake is executed before -# such an exported dependency file is processed. -# -# -# -# :: -# -# Note that if using IMPORTED targets, the qtmain.lib static library is -# automatically linked on Windows. To disable that globally, set the -# QT4_NO_LINK_QTMAIN variable before finding Qt4. To disable that for a -# particular executable, set the QT4_NO_LINK_QTMAIN target property to -# True on the executable. -# -# -# -# :: -# -# QT_INCLUDE_DIRS_NO_SYSTEM -# If this variable is set to TRUE, the Qt include directories -# in the QT_USE_FILE will NOT have the SYSTEM keyword set. -# -# -# -# There are also some files that need processing by some Qt tools such -# as moc and uic. Listed below are macros that may be used to process -# those files. +# target_link_libraries(myexe Qt4::QtGui Qt4::QtXml) +# +# .. note:: +# +# When using :prop_tgt:`IMPORTED` targets, the qtmain.lib static library is +# automatically linked on Windows. To disable that globally, set the +# ``QT4_NO_LINK_QTMAIN`` variable before finding Qt4. To disable that +# for a particular executable, set the ``QT4_NO_LINK_QTMAIN`` target +# property to ``TRUE`` on the executable. +# +# Qt Build Tools +# ============== +# +# Qt relies on some bundled tools for code generation, such as ``moc`` for +# meta-object code generation,``uic`` for widget layout and population, +# and ``rcc`` for virtual filesystem content generation. These tools may be +# automatically invoked by :manual:`cmake(1)` if the appropriate conditions +# are met. +# +# The tools are executed as part of a synthesized custom target generated by +# CMake. Target dependencies may be added to that custom target by adding them +# to the :prop_tgt:`AUTOGEN_TARGET_DEPENDS` target property. +# +# AUTOMOC +# ''''''' +# +# The :prop_tgt:`AUTOMOC` target property controls whether :manual:`cmake(1)` +# inspects the C++ files in the target to determine if they require ``moc`` to +# be run, and to create rules to execute ``moc`` at the appropriate time. +# +# If a ``Q_OBJECT`` or ``Q_GADGET`` macro is found in a header file, ``moc`` +# will be run on the file. The result will be put into a file named according +# to ``moc_<basename>.cpp``. If the macro is found in a C++ implementation +# file, the moc output will be put into a file named according to +# ``<basename>.moc``, following the Qt conventions. The ``moc file`` may be +# included by the user in the C++ implementation file with a preprocessor +# ``#include``. If it is not so included, it will be added to a separate file +# which is compiled into the target. +# +# Generated ``moc_*.cpp`` and ``*.moc`` files are placed in the build directory +# so it is convenient to set the :variable:`CMAKE_INCLUDE_CURRENT_DIR` +# variable. The :prop_tgt:`AUTOMOC` target property may be pre-set for all +# following targets by setting the :variable:`CMAKE_AUTOMOC` variable. The +# :prop_tgt:`AUTOMOC_MOC_OPTIONS` target property may be populated to set +# options to pass to ``moc``. The :variable:`CMAKE_AUTOMOC_MOC_OPTIONS` +# variable may be populated to pre-set the options for all following targets. +# +# AUTOUIC +# ''''''' +# +# The :prop_tgt:`AUTOUIC` target property controls whether :manual:`cmake(1)` +# inspects the C++ files in the target to determine if they require ``uic`` to +# be run, and to create rules to execute ``uic`` at the appropriate time. +# +# If a preprocessor ``#include`` directive is found which matches +# ``ui_<basename>.h``, and a ``<basename>.ui`` file exists, then ``uic`` will +# be executed to generate the appropriate file. +# +# Generated ``ui_*.h`` files are placed in the build directory so it is +# convenient to set the :variable:`CMAKE_INCLUDE_CURRENT_DIR` variable. The +# :prop_tgt:`AUTOUIC` target property may be pre-set for all following targets +# by setting the :variable:`CMAKE_AUTOUIC` variable. The +# :prop_tgt:`AUTOUIC_OPTIONS` target property may be populated to set options +# to pass to ``uic``. The :variable:`CMAKE_AUTOUIC_OPTIONS` variable may be +# populated to pre-set the options for all following targets. The +# :prop_sf:`AUTOUIC_OPTIONS` source file property may be set on the +# ``<basename>.ui`` file to set particular options for the file. This +# overrides options from the :prop_tgt:`AUTOUIC_OPTIONS` target property. +# +# AUTORCC +# ''''''' +# +# The :prop_tgt:`AUTORCC` target property controls whether :manual:`cmake(1)` +# creates rules to execute ``rcc`` at the appropriate time on source files +# which have the suffix ``.qrc``. +# +# .. code-block:: cmake +# +# add_executable(myexe main.cpp resource_file.qrc) +# +# The :prop_tgt:`AUTORCC` target property may be pre-set for all following targets +# by setting the :variable:`CMAKE_AUTORCC` variable. The +# :prop_tgt:`AUTORCC_OPTIONS` target property may be populated to set options +# to pass to ``rcc``. The :variable:`CMAKE_AUTORCC_OPTIONS` variable may be +# populated to pre-set the options for all following targets. The +# :prop_sf:`AUTORCC_OPTIONS` source file property may be set on the +# ``<name>.qrc`` file to set particular options for the file. This +# overrides options from the :prop_tgt:`AUTORCC_OPTIONS` target property. +# +# +# Qt Macros +# ========= +# +# In some cases it can be necessary or useful to invoke the Qt build tools in a +# more-manual way. Several macros are available to add targets for such uses. # # :: # @@ -116,7 +125,6 @@ # those found when executing "moc -help". # # -# # :: # # macro QT4_WRAP_UI(outfiles inputfile ... OPTIONS ...) @@ -125,7 +133,6 @@ # when executing "uic -help" # # -# # :: # # macro QT4_ADD_RESOURCES(outfiles inputfile ... OPTIONS ...) @@ -134,7 +141,6 @@ # when executing "rcc -help" # # -# # :: # # macro QT4_GENERATE_MOC(inputfile outputfile [TARGET tgt]) @@ -146,32 +152,6 @@ # the <tgt> are passed to moc. # # -# -# :: -# -# macro QT4_AUTOMOC(sourcefile1 sourcefile2 ... [TARGET tgt]) -# The qt4_automoc macro is obsolete. Use the CMAKE_AUTOMOC feature instead. -# This macro is still experimental. -# It can be used to have moc automatically handled. -# So if you have the files foo.h and foo.cpp, and in foo.h a -# a class uses the Q_OBJECT macro, moc has to run on it. If you don't -# want to use QT4_WRAP_CPP() (which is reliable and mature), you can insert -# #include "foo.moc" -# in foo.cpp and then give foo.cpp as argument to QT4_AUTOMOC(). This will the -# scan all listed files at cmake-time for such included moc files and if it finds -# them cause a rule to be generated to run moc at build time on the -# accompanying header file foo.h. -# If a source file has the SKIP_AUTOMOC property set it will be ignored by this macro. -# If the <tgt> is specified, the INTERFACE_INCLUDE_DIRECTORIES and -# INTERFACE_COMPILE_DEFINITIONS from the <tgt> are passed to moc. -# -# -# :: -# -# You should have a look on the AUTOMOC property for targets to achieve the same results. -# -# -# # :: # # macro QT4_ADD_DBUS_INTERFACE(outfiles interface basename) @@ -179,33 +159,16 @@ # given basename from the given interface xml file and add it to # the list of sources. # -# -# -# :: -# # You can pass additional parameters to the qdbusxml2cpp call by setting # properties on the input file: # -# -# -# :: -# # INCLUDE the given file will be included in the generate interface header # -# -# -# :: -# # CLASSNAME the generated class is named accordingly # -# -# -# :: -# # NO_NAMESPACE the generated class is not wrapped in a namespace # # -# # :: # # macro QT4_ADD_DBUS_INTERFACES(outfiles inputfile ... ) @@ -213,14 +176,9 @@ # for all listed interface xml files. # The basename will be automatically determined from the name of the xml file. # -# -# -# :: -# # The source file properties described for QT4_ADD_DBUS_INTERFACE also apply here. # # -# # :: # # macro QT4_ADD_DBUS_ADAPTOR(outfiles xmlfile parentheader parentclassname [basename] [classname]) @@ -233,7 +191,6 @@ # adaptor itself. # # -# # :: # # macro QT4_GENERATE_DBUS_INTERFACE( header [interfacename] OPTIONS ...) @@ -244,7 +201,6 @@ # Options may be given to qdbuscpp2xml, such as those found when executing "qdbuscpp2xml --help" # # -# # :: # # macro QT4_CREATE_TRANSLATION( qm_files directories ... sources ... @@ -263,7 +219,6 @@ # they get updated/generated. # # -# # :: # # macro QT4_ADD_TRANSLATION( qm_files ts_files ... ) @@ -274,11 +229,28 @@ # must exist and are not updated in any way. # # +# :: +# +# macro QT4_AUTOMOC(sourcefile1 sourcefile2 ... [TARGET tgt]) +# The qt4_automoc macro is obsolete. Use the CMAKE_AUTOMOC feature instead. +# This macro is still experimental. +# It can be used to have moc automatically handled. +# So if you have the files foo.h and foo.cpp, and in foo.h a +# a class uses the Q_OBJECT macro, moc has to run on it. If you don't +# want to use QT4_WRAP_CPP() (which is reliable and mature), you can insert +# #include "foo.moc" +# in foo.cpp and then give foo.cpp as argument to QT4_AUTOMOC(). This will the +# scan all listed files at cmake-time for such included moc files and if it finds +# them cause a rule to be generated to run moc at build time on the +# accompanying header file foo.h. +# If a source file has the SKIP_AUTOMOC property set it will be ignored by this macro. +# If the <tgt> is specified, the INTERFACE_INCLUDE_DIRECTORIES and +# INTERFACE_COMPILE_DEFINITIONS from the <tgt> are passed to moc. # -# function QT4_USE_MODULES( target [link_type] modules...) # # :: # +# function QT4_USE_MODULES( target [link_type] modules...) # This function is obsolete. Use target_link_libraries with IMPORTED targets instead. # Make <target> use the <modules> from Qt. Using a Qt module means # to link to the library, add the relevant include directories for the module, @@ -291,227 +263,100 @@ # to the target_link_libraries call. # # -# -# -# -# :: +# IMPORTED Targets +# ================ +# +# A particular Qt library may be used by using the corresponding +# :prop_tgt:`IMPORTED` target with the :command:`target_link_libraries` +# command: +# +# .. code-block:: cmake +# +# target_link_libraries(myexe Qt4::QtGui Qt4::QtXml) +# +# Using a target in this way causes :cmake(1)` to use the appropriate include +# directories and compile definitions for the target when compiling ``myexe``. +# +# Targets are aware of their dependencies, so for example it is not necessary +# to list ``Qt4::QtCore`` if another Qt library is listed, and it is not +# necessary to list ``Qt4::QtGui`` if ``Qt4::QtDeclarative`` is listed. +# Targets may be tested for existence in the usual way with the +# :command:`if(TARGET)` command. +# +# The Qt toolkit may contain both debug and release libraries. +# :manual:`cmake(1)` will choose the appropriate version based on the build +# configuration. +# +# ``Qt4::QtCore`` +# The QtCore target +# ``Qt4::QtGui`` +# The QtGui target +# ``Qt4::Qt3Support`` +# The Qt3Support target +# ``Qt4::QtAssistant`` +# The QtAssistant target +# ``Qt4::QtAssistantClient`` +# The QtAssistantClient target +# ``Qt4::QAxContainer`` +# The QAxContainer target (Windows only) +# ``Qt4::QAxServer`` +# The QAxServer target (Windows only) +# ``Qt4::QtDBus`` +# The QtDBus target +# ``Qt4::QtDesigner`` +# The QtDesigner target +# ``Qt4::QtDesignerComponents`` +# The QtDesignerComponents target +# ``Qt4::QtHelp`` +# The QtHelp target +# ``Qt4::QtMotif`` +# The QtMotif target +# ``Qt4::QtMultimedia`` +# The QtMultimedia target +# ``Qt4::QtNetwork`` +# The QtNetwork target +# ``Qt4::QtNsPLugin`` +# The QtNsPLugin target +# ``Qt4::QtOpenGL`` +# The QtOpenGL target +# ``Qt4::QtScript`` +# The QtScript target +# ``Qt4::QtScriptTools`` +# The QtScriptTools target +# ``Qt4::QtSql`` +# The QtSql target +# ``Qt4::QtSvg`` +# The QtSvg target +# ``Qt4::QtTest`` +# The QtTest target +# ``Qt4::QtUiTools`` +# The QtUiTools target +# ``Qt4::QtWebKit`` +# The QtWebKit target +# ``Qt4::QtXml`` +# The QtXml target +# ``Qt4::QtXmlPatterns`` +# The QtXmlPatterns target +# ``Qt4::phonon`` +# The phonon target +# +# Result Variables +# ================ # # Below is a detailed list of variables that FindQt4.cmake sets. -# QT_FOUND If false, don't try to use Qt. -# Qt4_FOUND If false, don't try to use Qt 4. -# QT4_FOUND If false, don't try to use Qt 4. This variable is for compatibility only. -# -# -# -# :: -# -# QT_VERSION_MAJOR The major version of Qt found. -# QT_VERSION_MINOR The minor version of Qt found. -# QT_VERSION_PATCH The patch version of Qt found. -# -# -# -# :: -# -# QT_EDITION Set to the edition of Qt (i.e. DesktopLight) -# QT_EDITION_DESKTOPLIGHT True if QT_EDITION == DesktopLight -# QT_QTCORE_FOUND True if QtCore was found. -# QT_QTGUI_FOUND True if QtGui was found. -# QT_QT3SUPPORT_FOUND True if Qt3Support was found. -# QT_QTASSISTANT_FOUND True if QtAssistant was found. -# QT_QTASSISTANTCLIENT_FOUND True if QtAssistantClient was found. -# QT_QAXCONTAINER_FOUND True if QAxContainer was found (Windows only). -# QT_QAXSERVER_FOUND True if QAxServer was found (Windows only). -# QT_QTDBUS_FOUND True if QtDBus was found. -# QT_QTDESIGNER_FOUND True if QtDesigner was found. -# QT_QTDESIGNERCOMPONENTS True if QtDesignerComponents was found. -# QT_QTHELP_FOUND True if QtHelp was found. -# QT_QTMOTIF_FOUND True if QtMotif was found. -# QT_QTMULTIMEDIA_FOUND True if QtMultimedia was found (since Qt 4.6.0). -# QT_QTNETWORK_FOUND True if QtNetwork was found. -# QT_QTNSPLUGIN_FOUND True if QtNsPlugin was found. -# QT_QTOPENGL_FOUND True if QtOpenGL was found. -# QT_QTSQL_FOUND True if QtSql was found. -# QT_QTSVG_FOUND True if QtSvg was found. -# QT_QTSCRIPT_FOUND True if QtScript was found. -# QT_QTSCRIPTTOOLS_FOUND True if QtScriptTools was found. -# QT_QTTEST_FOUND True if QtTest was found. -# QT_QTUITOOLS_FOUND True if QtUiTools was found. -# QT_QTWEBKIT_FOUND True if QtWebKit was found. -# QT_QTXML_FOUND True if QtXml was found. -# QT_QTXMLPATTERNS_FOUND True if QtXmlPatterns was found. -# QT_PHONON_FOUND True if phonon was found. -# QT_QTDECLARATIVE_FOUND True if QtDeclarative was found. -# -# -# -# :: -# -# QT_MAC_USE_COCOA For Mac OS X, its whether Cocoa or Carbon is used. -# In general, this should not be used, but its useful -# when having platform specific code. -# -# -# -# :: -# -# QT_DEFINITIONS Definitions to use when compiling code that uses Qt. -# You do not need to use this if you include QT_USE_FILE. -# The QT_USE_FILE will also define QT_DEBUG and QT_NO_DEBUG -# to fit your current build type. Those are not contained -# in QT_DEFINITIONS. -# -# -# -# :: -# -# QT_INCLUDES List of paths to all include directories of -# Qt4 QT_INCLUDE_DIR and QT_QTCORE_INCLUDE_DIR are -# always in this variable even if NOTFOUND, -# all other INCLUDE_DIRS are -# only added if they are found. -# You do not need to use this if you include QT_USE_FILE. -# -# -# -# -# -# :: -# -# Include directories for the Qt modules are listed here. -# You do not need to use these variables if you include QT_USE_FILE. -# -# -# -# :: -# -# QT_INCLUDE_DIR Path to "include" of Qt4 -# QT_QT3SUPPORT_INCLUDE_DIR Path to "include/Qt3Support" -# QT_QTASSISTANT_INCLUDE_DIR Path to "include/QtAssistant" -# QT_QTASSISTANTCLIENT_INCLUDE_DIR Path to "include/QtAssistant" -# QT_QAXCONTAINER_INCLUDE_DIR Path to "include/ActiveQt" (Windows only) -# QT_QAXSERVER_INCLUDE_DIR Path to "include/ActiveQt" (Windows only) -# QT_QTCORE_INCLUDE_DIR Path to "include/QtCore" -# QT_QTDBUS_INCLUDE_DIR Path to "include/QtDBus" -# QT_QTDESIGNER_INCLUDE_DIR Path to "include/QtDesigner" -# QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR Path to "include/QtDesigner" -# QT_QTGUI_INCLUDE_DIR Path to "include/QtGui" -# QT_QTHELP_INCLUDE_DIR Path to "include/QtHelp" -# QT_QTMOTIF_INCLUDE_DIR Path to "include/QtMotif" -# QT_QTMULTIMEDIA_INCLUDE_DIR Path to "include/QtMultimedia" -# QT_QTNETWORK_INCLUDE_DIR Path to "include/QtNetwork" -# QT_QTNSPLUGIN_INCLUDE_DIR Path to "include/QtNsPlugin" -# QT_QTOPENGL_INCLUDE_DIR Path to "include/QtOpenGL" -# QT_QTSCRIPT_INCLUDE_DIR Path to "include/QtScript" -# QT_QTSQL_INCLUDE_DIR Path to "include/QtSql" -# QT_QTSVG_INCLUDE_DIR Path to "include/QtSvg" -# QT_QTTEST_INCLUDE_DIR Path to "include/QtTest" -# QT_QTWEBKIT_INCLUDE_DIR Path to "include/QtWebKit" -# QT_QTXML_INCLUDE_DIR Path to "include/QtXml" -# QT_QTXMLPATTERNS_INCLUDE_DIR Path to "include/QtXmlPatterns" -# QT_PHONON_INCLUDE_DIR Path to "include/phonon" -# QT_QTSCRIPTTOOLS_INCLUDE_DIR Path to "include/QtScriptTools" -# QT_QTDECLARATIVE_INCLUDE_DIR Path to "include/QtDeclarative" -# -# -# -# :: -# -# QT_BINARY_DIR Path to "bin" of Qt4 -# QT_LIBRARY_DIR Path to "lib" of Qt4 -# QT_PLUGINS_DIR Path to "plugins" for Qt4 -# QT_TRANSLATIONS_DIR Path to "translations" of Qt4 -# QT_IMPORTS_DIR Path to "imports" of Qt4 -# QT_DOC_DIR Path to "doc" of Qt4 -# QT_MKSPECS_DIR Path to "mkspecs" of Qt4 -# -# -# -# -# -# The Qt toolkit may contain both debug and release libraries. In that -# case, the following library variables will contain both. You do not -# need to use these variables if you include QT_USE_FILE, and use -# QT_LIBRARIES. -# -# :: -# -# QT_QT3SUPPORT_LIBRARY The Qt3Support library -# QT_QTASSISTANT_LIBRARY The QtAssistant library -# QT_QTASSISTANTCLIENT_LIBRARY The QtAssistantClient library -# QT_QAXCONTAINER_LIBRARY The QAxContainer library (Windows only) -# QT_QAXSERVER_LIBRARY The QAxServer library (Windows only) -# QT_QTCORE_LIBRARY The QtCore library -# QT_QTDBUS_LIBRARY The QtDBus library -# QT_QTDESIGNER_LIBRARY The QtDesigner library -# QT_QTDESIGNERCOMPONENTS_LIBRARY The QtDesignerComponents library -# QT_QTGUI_LIBRARY The QtGui library -# QT_QTHELP_LIBRARY The QtHelp library -# QT_QTMOTIF_LIBRARY The QtMotif library -# QT_QTMULTIMEDIA_LIBRARY The QtMultimedia library -# QT_QTNETWORK_LIBRARY The QtNetwork library -# QT_QTNSPLUGIN_LIBRARY The QtNsPLugin library -# QT_QTOPENGL_LIBRARY The QtOpenGL library -# QT_QTSCRIPT_LIBRARY The QtScript library -# QT_QTSQL_LIBRARY The QtSql library -# QT_QTSVG_LIBRARY The QtSvg library -# QT_QTTEST_LIBRARY The QtTest library -# QT_QTUITOOLS_LIBRARY The QtUiTools library -# QT_QTWEBKIT_LIBRARY The QtWebKit library -# QT_QTXML_LIBRARY The QtXml library -# QT_QTXMLPATTERNS_LIBRARY The QtXmlPatterns library -# QT_QTMAIN_LIBRARY The qtmain library for Windows -# QT_PHONON_LIBRARY The phonon library -# QT_QTSCRIPTTOOLS_LIBRARY The QtScriptTools library -# -# -# -# The QtDeclarative library: QT_QTDECLARATIVE_LIBRARY -# -# also defined, but NOT for general use are -# -# :: -# -# QT_MOC_EXECUTABLE Where to find the moc tool. -# QT_UIC_EXECUTABLE Where to find the uic tool. -# QT_UIC3_EXECUTABLE Where to find the uic3 tool. -# QT_RCC_EXECUTABLE Where to find the rcc tool -# QT_DBUSCPP2XML_EXECUTABLE Where to find the qdbuscpp2xml tool. -# QT_DBUSXML2CPP_EXECUTABLE Where to find the qdbusxml2cpp tool. -# QT_LUPDATE_EXECUTABLE Where to find the lupdate tool. -# QT_LRELEASE_EXECUTABLE Where to find the lrelease tool. -# QT_QCOLLECTIONGENERATOR_EXECUTABLE Where to find the qcollectiongenerator tool. -# QT_DESIGNER_EXECUTABLE Where to find the Qt designer tool. -# QT_LINGUIST_EXECUTABLE Where to find the Qt linguist tool. -# -# -# -# -# -# These are around for backwards compatibility they will be set -# -# :: -# -# QT_WRAP_CPP Set true if QT_MOC_EXECUTABLE is found -# QT_WRAP_UI Set true if QT_UIC_EXECUTABLE is found -# -# -# -# These variables do _NOT_ have any effect anymore (compared to -# FindQt.cmake) -# -# :: -# -# QT_MT_REQUIRED Qt4 is now always multithreaded -# -# -# -# These variables are set to "" Because Qt structure changed (They make -# no sense in Qt4) -# -# :: # -# QT_QT_LIBRARY Qt-Library is now split +# ``Qt4_FOUND`` +# If false, don't try to use Qt 4. +# ``QT_FOUND`` +# If false, don't try to use Qt. This variable is for compatibility only. +# ``QT4_FOUND`` +# If false, don't try to use Qt 4. This variable is for compatibility only. +# ``QT_VERSION_MAJOR`` +# The major version of Qt found. +# ``QT_VERSION_MINOR`` +# The minor version of Qt found. +# ``QT_VERSION_PATCH`` +# The patch version of Qt found. #============================================================================= # Copyright 2005-2009 Kitware, Inc. diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake index 9f5b8a4..d868cb3 100644 --- a/Modules/GNUInstallDirs.cmake +++ b/Modules/GNUInstallDirs.cmake @@ -85,7 +85,31 @@ if(NOT DEFINED CMAKE_INSTALL_LOCALSTATEDIR) set(CMAKE_INSTALL_LOCALSTATEDIR "var" CACHE PATH "modifiable single-machine data (var)") endif() -if(NOT DEFINED CMAKE_INSTALL_LIBDIR) +# We check if the variable was manually set and not cached, in order to +# allow projects to set the values as normal variables before including +# GNUInstallDirs to avoid having the entries cached or user-editable. It +# replaces the "if(NOT DEFINED CMAKE_INSTALL_XXX)" checks in all the +# other cases. +# If CMAKE_INSTALL_LIBDIR is defined, if _libdir_set is false, then the +# variable is a normal one, otherwise it is a cache one. +get_property(_libdir_set CACHE CMAKE_INSTALL_LIBDIR PROPERTY TYPE SET) +if(NOT DEFINED CMAKE_INSTALL_LIBDIR OR (_libdir_set + AND DEFINED _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX + AND NOT "${_GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX}" STREQUAL "${CMAKE_INSTALL_PREFIX}")) + # If CMAKE_INSTALL_LIBDIR is not defined, it is always executed. + # Otherwise: + # * if _libdir_set is false it is not executed (meaning that it is + # not a cache variable) + # * if _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX is not defined it is + # not executed + # * if _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX and + # CMAKE_INSTALL_PREFIX are the same string it is not executed. + # _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX is updated after the + # execution, of this part of code, therefore at the next inclusion + # of the file, CMAKE_INSTALL_LIBDIR is defined, and the 2 strings + # are equal, meaning that the if is not executed the code the + # second time. + set(_LIBDIR_DEFAULT "lib") # Override this default 'lib' with 'lib64' iff: # - we are on Linux system but NOT cross-compiling @@ -94,13 +118,30 @@ if(NOT DEFINED CMAKE_INSTALL_LIBDIR) # reason is: amd64 ABI: http://www.x86-64.org/documentation/abi.pdf # For Debian with multiarch, use 'lib/${CMAKE_LIBRARY_ARCHITECTURE}' if # CMAKE_LIBRARY_ARCHITECTURE is set (which contains e.g. "i386-linux-gnu" + # and CMAKE_INSTALL_PREFIX is "/usr" # See http://wiki.debian.org/Multiarch + if(DEFINED _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX) + set(__LAST_LIBDIR_DEFAULT "lib") + # __LAST_LIBDIR_DEFAULT is the default value that we compute from + # _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX, not a cache entry for + # the value that was last used as the default. + # This value is used to figure out whether the user changed the + # CMAKE_INSTALL_LIBDIR value manually, or if the value was the + # default one. When CMAKE_INSTALL_PREFIX changes, the value is + # updated to the new default, unless the user explicitly changed it. + endif() if(CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$" AND NOT CMAKE_CROSSCOMPILING) if (EXISTS "/etc/debian_version") # is this a debian system ? - if(CMAKE_LIBRARY_ARCHITECTURE) - set(_LIBDIR_DEFAULT "lib/${CMAKE_LIBRARY_ARCHITECTURE}") - endif() + if(CMAKE_LIBRARY_ARCHITECTURE) + if("${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$") + set(_LIBDIR_DEFAULT "lib/${CMAKE_LIBRARY_ARCHITECTURE}") + endif() + if(DEFINED _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX + AND "${_GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$") + set(__LAST_LIBDIR_DEFAULT "lib/${CMAKE_LIBRARY_ARCHITECTURE}") + endif() + endif() else() # not debian, rely on CMAKE_SIZEOF_VOID_P: if(NOT DEFINED CMAKE_SIZEOF_VOID_P) message(AUTHOR_WARNING @@ -109,12 +150,25 @@ if(NOT DEFINED CMAKE_INSTALL_LIBDIR) else() if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") set(_LIBDIR_DEFAULT "lib64") + if(DEFINED _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX) + set(__LAST_LIBDIR_DEFAULT "lib64") + endif() endif() endif() endif() endif() - set(CMAKE_INSTALL_LIBDIR "${_LIBDIR_DEFAULT}" CACHE PATH "object code libraries (${_LIBDIR_DEFAULT})") + if(NOT DEFINED CMAKE_INSTALL_LIBDIR) + set(CMAKE_INSTALL_LIBDIR "${_LIBDIR_DEFAULT}" CACHE PATH "object code libraries (${_LIBDIR_DEFAULT})") + elseif(DEFINED __LAST_LIBDIR_DEFAULT + AND "${__LAST_LIBDIR_DEFAULT}" STREQUAL "${CMAKE_INSTALL_LIBDIR}") + set_property(CACHE CMAKE_INSTALL_LIBDIR PROPERTY VALUE "${_LIBDIR_DEFAULT}") + endif() endif() +# Save for next run +set(_GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" CACHE INTERNAL "CMAKE_INSTALL_PREFIX during last run") +unset(_libdir_set) +unset(__LAST_LIBDIR_DEFAULT) + if(NOT DEFINED CMAKE_INSTALL_INCLUDEDIR) set(CMAKE_INSTALL_INCLUDEDIR "include" CACHE PATH "C header files (include)") diff --git a/Modules/Platform/QNX-QCC-C.cmake b/Modules/Platform/QNX-QCC-C.cmake new file mode 100644 index 0000000..e5721a7 --- /dev/null +++ b/Modules/Platform/QNX-QCC-C.cmake @@ -0,0 +1,4 @@ + +include(Platform/QNX) + +__compiler_qcc(C) diff --git a/Modules/Platform/QNX-QCC-CXX.cmake b/Modules/Platform/QNX-QCC-CXX.cmake new file mode 100644 index 0000000..e490bbe --- /dev/null +++ b/Modules/Platform/QNX-QCC-CXX.cmake @@ -0,0 +1,4 @@ + +include(Platform/QNX) + +__compiler_qcc(CXX) diff --git a/Modules/Platform/QNX.cmake b/Modules/Platform/QNX.cmake index 9afde05..cc551bd 100644 --- a/Modules/Platform/QNX.cmake +++ b/Modules/Platform/QNX.cmake @@ -1,24 +1,6 @@ set(QNXNTO 1) -# The QNX GCC does not seem to have -isystem so remove the flag. -set(CMAKE_INCLUDE_SYSTEM_FLAG_C) -set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX) -# ... Nor does the driver support appropriate flags to create depfiles. -set(CMAKE_DEPFILE_FLAGS_C) -set(CMAKE_DEPFILE_FLAGS_CXX) - set(CMAKE_DL_LIBS "") -set(CMAKE_SHARED_LIBRARY_C_FLAGS "") -set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "") -set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") -set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") -set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") -set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") -set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") -set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") -# http://www.qnx.com/developers/docs/6.4.0/neutrino/utilities/q/qcc.html#examples -set(CMAKE_C_COMPILE_OPTIONS_TARGET "-V") -set(CMAKE_CXX_COMPILE_OPTIONS_TARGET "-V") # Shared libraries with no builtin soname may not be linked safely by # specifying the file path. @@ -32,8 +14,22 @@ foreach(type SHARED_LIBRARY SHARED_MODULE EXE) set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") endforeach() -# force the language to be c++ since qnx only has gcc and not g++ and c++? -set(CMAKE_CXX_COMPILE_OBJECT - "<CMAKE_CXX_COMPILER> -x c++ <DEFINES> <FLAGS> -o <OBJECT> -c <SOURCE>") -include(Platform/UnixPaths) +include(Platform/GNU) +unset(CMAKE_LIBRARY_ARCHITECTURE_REGEX) + +macro(__compiler_qcc lang) + # http://www.qnx.com/developers/docs/6.4.0/neutrino/utilities/q/qcc.html#examples + set(CMAKE_${lang}_COMPILE_OPTIONS_TARGET "-V") + + set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-Wp,-isystem,") + set(CMAKE_DEPFILE_FLAGS_${lang} "-Wc,-MMD,<DEPFILE>,-MT,<OBJECT>,-MF,<DEPFILE>") + + if (lang STREQUAL CXX) + # If the toolchain uses qcc for CMAKE_CXX_COMPILER instead of QCC, the + # default for the driver is not c++. + set(CMAKE_CXX_COMPILE_OBJECT + "<CMAKE_CXX_COMPILER> -lang-c++ <DEFINES> <FLAGS> -o <OBJECT> -c <SOURCE>") + endif() + +endmacro() |