CMake: pro2cmake.py: Convert more settings from .pro-file to CMake
Convert QMAKE_USE, QMAKE_CXX_FLAGS and QMAKE_LFLAGS into CMake. Change-Id: I53a5b91664b6ab71892d4381c00f8d744d7d7abd Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
This commit is contained in:
parent
f80a37dcca
commit
4d4bf61f9f
@ -243,8 +243,8 @@ function(qt_internal_module_info result target)
|
||||
endfunction()
|
||||
|
||||
|
||||
set(__default_private_args "SOURCES;LIBRARIES;INCLUDE_DIRECTORIES;DEFINES;DBUS_ADAPTOR_BASENAME;DBUS_ADAPTOR_FLAGS;DBUS_ADAPTOR_SOURCES;DBUS_INTERFACE_BASENAME;DBUS_INTERFACE_FLAGS;DBUS_INTERFACE_SOURCES;FEATURE_DEPENDENCIES")
|
||||
set(__default_public_args "PUBLIC_LIBRARIES;PUBLIC_INCLUDE_DIRECTORIES;PUBLIC_DEFINES")
|
||||
set(__default_private_args "SOURCES;LIBRARIES;INCLUDE_DIRECTORIES;DEFINES;DBUS_ADAPTOR_BASENAME;DBUS_ADAPTOR_FLAGS;DBUS_ADAPTOR_SOURCES;DBUS_INTERFACE_BASENAME;DBUS_INTERFACE_FLAGS;DBUS_INTERFACE_SOURCES;FEATURE_DEPENDENCIES;COMPILE_OPTIONS;LINK_OPTIONS")
|
||||
set(__default_public_args "PUBLIC_LIBRARIES;PUBLIC_INCLUDE_DIRECTORIES;PUBLIC_DEFINES;PUBLIC_COMPILE_OPTIONS;PUBLIC_LINK_OPTIONS")
|
||||
|
||||
|
||||
# This function can be used to add sources/libraries/etc. to the specified CMake target
|
||||
@ -288,6 +288,8 @@ function(extend_target target)
|
||||
target_include_directories("${target}" PUBLIC ${arg_PUBLIC_INCLUDE_DIRECTORIES} PRIVATE ${arg_INCLUDE_DIRECTORIES})
|
||||
target_compile_definitions("${target}" PUBLIC ${arg_PUBLIC_DEFINES} PRIVATE ${arg_DEFINES})
|
||||
target_link_libraries("${target}" PUBLIC ${arg_PUBLIC_LIBRARIES} PRIVATE ${arg_LIBRARIES})
|
||||
target_compile_options("${target}" PUBLIC ${arg_PUBLIC_COMPILE_OPTIONS} PRIVATE ${arg_COMPILE_OPTIONS})
|
||||
target_link_options("${target}" PUBLIC ${arg_PUBLIC_LINK_OPTIONS} PRIVATE ${arg_LINK_OPTIONS})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
@ -440,6 +442,10 @@ function(add_qt_module target)
|
||||
DBUS_ADAPTOR_FLAGS ${arg_DBUS_ADAPTOR_FLAGS}
|
||||
DBUS_INTERFACE_SOURCES ${arg_DBUS_INTERFACE_SOURCES}
|
||||
DBUS_INTERFACE_FLAGS ${arg_DBUS_INTERFACE_FLAGS}
|
||||
COMPILE_OPTIONS ${arg_COMPILE_OPTIONS}
|
||||
PUBLIC_COMPILE_OPTIONS ${arg_PUBLIC_COMPILE_OPTIONS}
|
||||
LINK_OPTIONS ${arg_LINK_OPTIONS}
|
||||
PUBLIC_LINK_OPTIONS ${arg_PUBLIC_LINK_OPTIONS}
|
||||
)
|
||||
|
||||
set(configureFile "${CMAKE_CURRENT_SOURCE_DIR}/configure.cmake")
|
||||
@ -571,6 +577,10 @@ function(add_qt_plugin target)
|
||||
DBUS_ADAPTOR_FLAGS "${arg_DBUS_ADAPTOR_FLAGS}"
|
||||
DBUS_INTERFACE_SOURCES "${arg_DBUS_INTERFACE_SOURCES}"
|
||||
DBUS_INTERFACE_FLAGS "${arg_DBUS_INTERFACE_FLAGS}"
|
||||
COMPILE_OPTIONS ${arg_COMPILE_OPTIONS}
|
||||
PUBLIC_COMPILE_OPTIONS ${arg_PUBLIC_COMPILE_OPTIONS}
|
||||
LINK_OPTIONS ${arg_LINK_OPTIONS}
|
||||
PUBLIC_LINK_OPTIONS ${arg_PUBLIC_LINK_OPTIONS}
|
||||
)
|
||||
|
||||
install(TARGETS "${target}" EXPORT "${target}Targets"
|
||||
@ -612,6 +622,8 @@ function(add_qt_executable name)
|
||||
DBUS_ADAPTOR_FLAGS "${arg_DBUS_ADAPTOR_FLAGS}"
|
||||
DBUS_INTERFACE_SOURCES "${arg_DBUS_INTERFACE_SOURCES}"
|
||||
DBUS_INTERFACE_FLAGS "${arg_DBUS_INTERFACE_FLAGS}"
|
||||
COMPILE_OPTIONS ${arg_COMPILE_OPTIONS}
|
||||
LINK_OPTIONS ${arg_LINK_OPTIONS}
|
||||
)
|
||||
set_target_properties("${name}" PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY "${arg_OUTPUT_DIRECTORY}"
|
||||
@ -635,6 +647,8 @@ function(add_qt_test name)
|
||||
"${arg_INCLUDE_DIRECTORIES}"
|
||||
DEFINES "${arg_DEFINES}"
|
||||
LIBRARIES Qt::Core Qt::Test ${arg_LIBRARIES}
|
||||
COMPILE_OPTIONS ${arg_COMPILE_OPTIONS}
|
||||
LINK_OPTIONS ${arg_LINK_OPTIONS}
|
||||
)
|
||||
|
||||
add_test(NAME "${name}" COMMAND "${name}" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
@ -670,6 +684,8 @@ function(add_qt_tool name)
|
||||
${arg_INCLUDE_DIRECTORIES}
|
||||
DEFINES ${arg_DEFINES}
|
||||
LIBRARIES ${corelib} ${arg_LIBRARIES}
|
||||
COMPILE_OPTIONS ${arg_COMPILE_OPTIONS}
|
||||
LINK_OPTIONS ${arg_LINK_OPTIONS}
|
||||
)
|
||||
qt_internal_add_target_aliases("${name}")
|
||||
|
||||
|
@ -708,7 +708,7 @@ def write_sources_section(cm_fh: typing.IO[str], scope: Scope, *,
|
||||
if map_qt_library(q) not in known_libraries]
|
||||
dependencies += [map_qt_library(q) for q in scope.get('QT_FOR_PRIVATE')
|
||||
if map_qt_library(q) not in known_libraries]
|
||||
dependencies += scope.get('QMAKE_USE_PRIVATE') \
|
||||
dependencies += scope.get('QMAKE_USE_PRIVATE') + scope.get('QMAKE_USE') \
|
||||
+ scope.get('LIBS_PRIVATE') + scope.get('LIBS')
|
||||
if dependencies:
|
||||
cm_fh.write('{} LIBRARIES\n'.format(ind))
|
||||
@ -729,6 +729,18 @@ def write_sources_section(cm_fh: typing.IO[str], scope: Scope, *,
|
||||
cm_fh.write('{} {}\n'.format(ind, d))
|
||||
is_framework = False
|
||||
|
||||
compile_options = scope.get('QMAKE_CXXFLAGS')
|
||||
if compile_options:
|
||||
cm_fh.write('{} COMPILE_OPTIONS\n'.format(ind))
|
||||
for co in compile_options:
|
||||
cm_fh.write('{} "{}"\n'.format(ind, co))
|
||||
|
||||
link_options = scope.get('QMAKE_LFLAGS')
|
||||
if link_options:
|
||||
cm_fh.write('{} LINK_OPTIONS\n'.format(ind))
|
||||
for lo in link_options:
|
||||
cm_fh.write('{} "{}"\n'.format(ind, lo))
|
||||
|
||||
return set(scope.keys) - scope.visited_keys
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user