Commit baef96be authored by Patric Schmitz's avatar Patric Schmitz

unify indentation in ACGQt.cmake

parent f3428ce1
......@@ -12,13 +12,13 @@ endmacro()
macro (acg_qt5)
if(POLICY CMP0020)
# Automatically link Qt executables to qtmain target on Windows
cmake_policy(SET CMP0020 NEW)
endif(POLICY CMP0020)
if(POLICY CMP0020)
# Automatically link Qt executables to qtmain target on Windows
cmake_policy(SET CMP0020 NEW)
endif(POLICY CMP0020)
#if (NOT QT5_FOUND)
#set (QT_MIN_VERSION ${ARGN})
#set (QT_MIN_VERSION ${ARGN})
#try to find qt5 automatically
#for custom installation of qt5, dont use any of these variables
......@@ -47,14 +47,14 @@ macro (acg_qt5)
Qt5Network
Qt5Sql
Qt5Script
Qt5ScriptTools
Qt5Xml
Qt5XmlPatterns
Qt5Help
Qt5UiTools
Qt5Svg
Qt5PrintSupport
Qt5Concurrent
Qt5ScriptTools
Qt5Xml
Qt5XmlPatterns
Qt5Help
Qt5UiTools
Qt5Svg
Qt5PrintSupport
Qt5Concurrent
)
find_package (Qt5Core PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS})
......@@ -104,13 +104,13 @@ macro (acg_qt5)
if (QT5_FOUND)
acg_unset_qt_shared_variables(5)
#set plugin dir
list(GET Qt5Gui_PLUGINS 0 _plugin)
if (_plugin)
get_target_property(_plugin_full ${_plugin} LOCATION)
get_filename_component(_plugin_dir ${_plugin_full} PATH)
set (QT_PLUGINS_DIR "${_plugin_dir}/../" CACHE PATH "Path to the qt plugin directory")
set (QT_PLUGINS_DIR "${_plugin_dir}/../" CACHE PATH "Path to the qt plugin directory")
elseif(QT5_INSTALL_PATH_EXISTS)
set (QT_PLUGINS_DIR "${QT5_INSTALL_PATH}/plugins/" CACHE PATH "Path to the qt plugin directory")
elseif()
......@@ -129,7 +129,7 @@ macro (acg_qt5)
mark_as_advanced(QT_BINARY_DIR)
set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
foreach(QT_PACKAGE IN LISTS QT5_REQUIRED_PACKAGES)
include_directories(${${QT_PACKAGE}_INCLUDE_DIRS})
add_definitions(${${QT_PACKAGE}_DEFINITIONS})
......@@ -142,29 +142,29 @@ macro (acg_qt5)
if(MSVC)
set(QT_LIBRARIES ${QT_LIBRARIES} ${Qt5Core_QTMAIN_LIBRARIES})
endif()
endif()
#add_definitions(-DQT_NO_OPENGL)
#adding QT_NO_DEBUG to all release modes.
# Note: for multi generators like msvc you cannot set this definition depending of
# the current build type, because it may change in the future inside the ide and not via cmake
if (MSVC_IDE)
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /DQT_NO_DEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /DQT_NO_DEBUG")
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_RELEASE} /DQT_NO_DEBUG")
set(CMAKE_CXX_FLAGS_MINSITEREL "${CMAKE_C_FLAGS_RELEASE} /DQT_NO_DEBUG")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELEASE} /DQT_NO_DEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELEASE} /DQT_NO_DEBUG")
else(MSVC_IDE)
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-DQT_NO_DEBUG)
endif()
endif(MSVC_IDE)
#add_definitions(-DQT_NO_OPENGL)
endif ()
#adding QT_NO_DEBUG to all release modes.
# Note: for multi generators like msvc you cannot set this definition depending of
# the current build type, because it may change in the future inside the ide and not via cmake
if (MSVC_IDE)
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /DQT_NO_DEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /DQT_NO_DEBUG")
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_RELEASE} /DQT_NO_DEBUG")
set(CMAKE_CXX_FLAGS_MINSITEREL "${CMAKE_C_FLAGS_RELEASE} /DQT_NO_DEBUG")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELEASE} /DQT_NO_DEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELEASE} /DQT_NO_DEBUG")
else(MSVC_IDE)
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-DQT_NO_DEBUG)
endif()
endif(MSVC_IDE)
endif ()
endmacro ()
# generate moc targets for sources in list
......@@ -176,39 +176,39 @@ macro (acg_qt5_automoc moc_SRCS)
set (_matching_FILES )
foreach (_current_FILE ${ARGN})
get_filename_component (_abs_FILE ${_current_FILE} ABSOLUTE)
# if "SKIP_AUTOMOC" is set to true, we will not handle this file here.
# here. this is required to make bouic work correctly:
# we need to add generated .cpp files to the sources (to compile them),
# but we cannot let automoc handle them, as the .cpp files don't exist yet when
# cmake is run for the very first time on them -> however the .cpp files might
# exist at a later run. at that time we need to skip them, so that we don't add two
# different rules for the same moc file
get_source_file_property (_skip ${_abs_FILE} SKIP_AUTOMOC)
get_filename_component (_abs_FILE ${_current_FILE} ABSOLUTE)
# if "SKIP_AUTOMOC" is set to true, we will not handle this file here.
# here. this is required to make bouic work correctly:
# we need to add generated .cpp files to the sources (to compile them),
# but we cannot let automoc handle them, as the .cpp files don't exist yet when
# cmake is run for the very first time on them -> however the .cpp files might
# exist at a later run. at that time we need to skip them, so that we don't add two
# different rules for the same moc file
get_source_file_property (_skip ${_abs_FILE} SKIP_AUTOMOC)
if ( NOT _skip AND EXISTS ${_abs_FILE} )
if ( NOT _skip AND EXISTS ${_abs_FILE} )
file (READ ${_abs_FILE} _contents)
file (READ ${_abs_FILE} _contents)
get_filename_component (_abs_PATH ${_abs_FILE} PATH)
get_filename_component (_abs_PATH ${_abs_FILE} PATH)
string (REGEX MATCHALL "Q_OBJECT" _match "${_contents}")
if (_match)
get_filename_component (_basename ${_current_FILE} NAME_WE)
set (_header ${_abs_FILE})
set (_moc ${CMAKE_CURRENT_BINARY_DIR}/moc_${_basename}.cpp)
string (REGEX MATCHALL "Q_OBJECT" _match "${_contents}")
if (_match)
get_filename_component (_basename ${_current_FILE} NAME_WE)
set (_header ${_abs_FILE})
set (_moc ${CMAKE_CURRENT_BINARY_DIR}/moc_${_basename}.cpp)
add_custom_command (OUTPUT ${_moc}
COMMAND ${QT_MOC_EXECUTABLE}
ARGS ${_moc_INCS} ${_header} -o ${_moc}
DEPENDS ${_header}
)
add_custom_command (OUTPUT ${_moc}
COMMAND ${QT_MOC_EXECUTABLE}
ARGS ${_moc_INCS} ${_header} -o ${_moc}
DEPENDS ${_header}
)
add_file_dependencies (${_abs_FILE} ${_moc})
set (${moc_SRCS} ${${moc_SRCS}} ${_moc})
add_file_dependencies (${_abs_FILE} ${_moc})
set (${moc_SRCS} ${${moc_SRCS}} ${_moc})
endif ()
endif ()
endif ()
endif ()
endforeach ()
endmacro ()
......@@ -218,29 +218,29 @@ macro (acg_qt5_autouic uic_SRCS)
set (_matching_FILES )
foreach (_current_FILE ${ARGN})
get_filename_component (_abs_FILE ${_current_FILE} ABSOLUTE)
get_filename_component (_abs_FILE ${_current_FILE} ABSOLUTE)
if ( EXISTS ${_abs_FILE} )
if ( EXISTS ${_abs_FILE} )
file (READ ${_abs_FILE} _contents)
file (READ ${_abs_FILE} _contents)
get_filename_component (_abs_PATH ${_abs_FILE} PATH)
get_filename_component (_abs_PATH ${_abs_FILE} PATH)
get_filename_component (_basename ${_current_FILE} NAME_WE)
string (REGEX REPLACE "Ui$" "" _cbasename ${_basename})
set (_outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${_basename}.hh)
set (_header ${_basename}.hh)
set (_source ${_abs_PATH}/${_cbasename}.cc)
get_filename_component (_basename ${_current_FILE} NAME_WE)
string (REGEX REPLACE "Ui$" "" _cbasename ${_basename})
set (_outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${_basename}.hh)
set (_header ${_basename}.hh)
set (_source ${_abs_PATH}/${_cbasename}.cc)
add_custom_command (OUTPUT ${_outfile}
COMMAND ${Qt5Widgets_UIC_EXECUTABLE}
ARGS -o ${_outfile} ${_abs_FILE}
MAIN_DEPENDENCY ${_abs_FILE} VERBATIM)
add_custom_command (OUTPUT ${_outfile}
COMMAND ${Qt5Widgets_UIC_EXECUTABLE}
ARGS -o ${_outfile} ${_abs_FILE}
MAIN_DEPENDENCY ${_abs_FILE} VERBATIM)
add_file_dependencies (${_source} ${_outfile})
set (${uic_SRCS} ${${uic_SRCS}} ${_outfile})
add_file_dependencies (${_source} ${_outfile})
set (${uic_SRCS} ${${uic_SRCS}} ${_outfile})
endif ()
endif ()
endforeach ()
endmacro ()
......@@ -250,23 +250,23 @@ macro (acg_qt5_autoqrc qrc_SRCS)
set (_matching_FILES )
foreach (_current_FILE ${ARGN})
get_filename_component (_abs_FILE ${_current_FILE} ABSOLUTE)
get_filename_component (_abs_FILE ${_current_FILE} ABSOLUTE)
if ( EXISTS ${_abs_FILE} )
if ( EXISTS ${_abs_FILE} )
file (READ ${_abs_FILE} _contents)
file (READ ${_abs_FILE} _contents)
get_filename_component (_abs_PATH ${_abs_FILE} PATH)
get_filename_component (_abs_PATH ${_abs_FILE} PATH)
get_filename_component (_basename ${_current_FILE} NAME_WE)
set (_outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${_basename}.cpp)
get_filename_component (_basename ${_current_FILE} NAME_WE)
set (_outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${_basename}.cpp)
qt5_add_resources( ${_outfile} ${_abs_FILE} )
qt5_add_resources( ${_outfile} ${_abs_FILE} )
add_file_dependencies (${_source} ${_outfile})
set (${qrc_SRCS} ${${qrc_SRCS}} ${_outfile})
add_file_dependencies (${_source} ${_outfile})
set (${qrc_SRCS} ${${qrc_SRCS}} ${_outfile})
endif ()
endif ()
endforeach ()
endmacro ()
......@@ -320,10 +320,10 @@ function (acg_add_translations _target _languages _sources)
foreach (_qm ${_qm_files})
get_filename_component (_qm_name "${_qm}" NAME)
add_custom_command (TARGET tr_${_target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E
copy_if_different
${_qm}
${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Translations/${_qm_name})
COMMAND ${CMAKE_COMMAND} -E
copy_if_different
${_qm}
${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Translations/${_qm_name})
endforeach ()
if (NOT ACG_PROJECT_MACOS_BUNDLE OR NOT APPLE)
......@@ -334,27 +334,27 @@ endfunction ()
# Function that writes all generated qch files into one Help.qhcp project file
function (generate_qhp_file files_loc plugin_name)
set(qhp_file "${files_loc}/${plugin_name}.qhp")
# Read in template file
file(STRINGS "${CMAKE_SOURCE_DIR}/OpenFlipper/Documentation/QtHelpResources/QtHelpProject.qhp" qhp_template)
# Initialize new project file
file(WRITE ${qhp_file} "")
foreach (_line ${qhp_template})
string(STRIP ${_line} stripped)
if("${stripped}" STREQUAL "files")
acg_get_files_in_dir (_files ${files_loc})
foreach (_file ${_files})
string(REGEX MATCH ".+[.]+((html)|(htm)|(xml))$" fileresult ${_file})
string(LENGTH "${fileresult}" len)
if(${len} GREATER 0)
file(APPEND ${qhp_file} "<file>${_file}</file>\n")
endif()
endforeach()
else()
string(REGEX REPLACE "plugin" ${plugin} newline ${_line})
file(APPEND ${qhp_file} "${newline}\n")
set(qhp_file "${files_loc}/${plugin_name}.qhp")
# Read in template file
file(STRINGS "${CMAKE_SOURCE_DIR}/OpenFlipper/Documentation/QtHelpResources/QtHelpProject.qhp" qhp_template)
# Initialize new project file
file(WRITE ${qhp_file} "")
foreach (_line ${qhp_template})
string(STRIP ${_line} stripped)
if("${stripped}" STREQUAL "files")
acg_get_files_in_dir (_files ${files_loc})
foreach (_file ${_files})
string(REGEX MATCH ".+[.]+((html)|(htm)|(xml))$" fileresult ${_file})
string(LENGTH "${fileresult}" len)
if(${len} GREATER 0)
file(APPEND ${qhp_file} "<file>${_file}</file>\n")
endif()
endforeach()
endforeach()
else()
string(REGEX REPLACE "plugin" ${plugin} newline ${_line})
file(APPEND ${qhp_file} "${newline}\n")
endif()
endforeach()
endfunction()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment