Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Base/Testing/Cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ foreach(file IN ITEMS
)
set(moc_file moc_${file})
if(CTKAppLauncher_QT_VERSION VERSION_EQUAL "5")
QT5_GENERATE_MOC(${file} ${moc_file})
qt5_generate_moc(${file} ${moc_file})
else()
message(FATAL_ERROR "Setting CTKAppLauncher_QT_VERSION to '${CTKAppLauncher_QT_VERSION}' is not supported")
qt_generate_moc(${file} ${moc_file})
endif()
macro_add_file_dependencies(${file} ${CMAKE_CURRENT_BINARY_DIR}/${moc_file})
endforeach()
Expand Down
2 changes: 1 addition & 1 deletion Base/ctkAppArguments.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
#include <QPair>
#include <QScopedPointer>
#include <QString>
#include <QStringList>

// --------------------------------------------------------------------------
class ctkChar2DArrayPrivate;
class QStringList;

// --------------------------------------------------------------------------
class ctkChar2DArray
Expand Down
8 changes: 5 additions & 3 deletions Base/ctkAppLauncher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,16 @@ ctkInteractiveProcess::ctkInteractiveProcess(QObject* parent)
}

// --------------------------------------------------------------------------
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
void ctkInteractiveProcess::setupChildProcess()
{
#ifdef Q_OS_WIN32
# ifdef Q_OS_WIN32
::_dup2(StdinClone, _fileno(stdin));
#else
# else
::dup2(StdinClone, fileno(stdin));
#endif
# endif
}
#endif

// --------------------------------------------------------------------------
// ctkAppLauncherPrivate methods
Expand Down
2 changes: 2 additions & 0 deletions Base/ctkAppLauncher_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ class ctkInteractiveProcess : public QProcess
ctkInteractiveProcess(QObject* parent = 0);

protected:
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
virtual void setupChildProcess();
#endif
};

// --------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion Base/ctkSettingsHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
// Qt includes
#include <QHash>
#include <QString>
#include <QStringList>

class QSettings;
class QStringList;

namespace ctk
{
Expand Down
16 changes: 13 additions & 3 deletions CMake/ctkMacroBuildLib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,20 @@ macro(ctkMacroBuildLib)

# Wrap
if(CTKAppLauncher_QT_VERSION VERSION_EQUAL "5")
QT5_WRAP_CPP(${prefix}_MOC_CXX ${${prefix}_MOC_SRCS})
QT5_WRAP_UI(${prefix}_UI_CXX ${${prefix}_UI_FORMS})
qt5_wrap_cpp(${prefix}_MOC_CXX ${${prefix}_MOC_SRCS})
if(${prefix}_UI_FORMS)
qt5_wrap_ui(${prefix}_UI_CXX ${${prefix}_UI_FORMS})
endif()
if(DEFINED ${prefix}_RESOURCES)
qt5_add_resources(${prefix}_QRC_SRCS ${${prefix}_RESOURCES})
endif()
elseif(CTKAppLauncher_QT_VERSION VERSION_EQUAL "6")
qt_wrap_cpp(${prefix}_MOC_CXX ${${prefix}_MOC_SRCS})
if(${prefix}_UI_FORMS)
qt_wrap_ui(${prefix}_UI_CXX ${${prefix}_UI_FORMS})
endif()
if(DEFINED ${prefix}_RESOURCES)
QT5_ADD_RESOURCES(${prefix}_QRC_SRCS ${${prefix}_RESOURCES})
qt_add_resources(${prefix}_QRC_SRCS ${${prefix}_RESOURCES})
endif()
else()
message(FATAL_ERROR "Setting CTKAppLauncher_QT_VERSION to '${CTKAppLauncher_QT_VERSION}' is not supported")
Expand Down
21 changes: 11 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -246,23 +246,24 @@ endif()
#

set(default_qt_version "5")
if(DEFINED Qt6_DIR)
set(default_qt_version "6")
endif()
set(CTKAppLauncher_QT_VERSION "${default_qt_version}" CACHE STRING "Expected Qt version")
mark_as_advanced(CTKAppLauncher_QT_VERSION)

set_property(CACHE CTKAppLauncher_QT_VERSION PROPERTY STRINGS 5)
set_property(CACHE CTKAppLauncher_QT_VERSION PROPERTY STRINGS 5 6)

if(NOT (CTKAppLauncher_QT_VERSION VERSION_EQUAL "5"))
message(FATAL_ERROR "Expected value for CTKAppLauncher_QT_VERSION is '5'")
if(NOT (CTKAppLauncher_QT_VERSION MATCHES "^(5|6)$"))
message(FATAL_ERROR "Expected value for CTKAppLauncher_QT_VERSION is either '5' or '6'")
endif()

if(CTKAppLauncher_QT_VERSION VERSION_EQUAL "5")
set(CTKAppLauncher_QT5_COMPONENTS Core Widgets)
if(BUILD_TESTING)
list(APPEND CTKAppLauncher_QT5_COMPONENTS Test)
endif()
find_package(Qt5 COMPONENTS ${CTKAppLauncher_QT5_COMPONENTS} REQUIRED)
set(QT_LIBRARIES Qt5::Widgets ${CTKAppLauncher_QT_STATIC_LIBRARIES})
set(CTKAppLauncher_QT_COMPONENTS Core Widgets)
if(BUILD_TESTING)
list(APPEND CTKAppLauncher_QT_COMPONENTS Test)
endif()
find_package(Qt${CTKAppLauncher_QT_VERSION} COMPONENTS ${CTKAppLauncher_QT_COMPONENTS} REQUIRED)
set(QT_LIBRARIES Qt${CTKAppLauncher_QT_VERSION}::Widgets ${CTKAppLauncher_QT_STATIC_LIBRARIES})

#-----------------------------------------------------------------------------
# Build ctkAppLauncherBase and associated tests
Expand Down
1 change: 1 addition & 0 deletions linux-static-configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,5 @@ execute_process(COMMAND
-G Ninja
-S ${CTKAppLauncher_SOURCE_DIR}
-B ${CTKAppLauncher_BUILD_DIR}
COMMAND_ERROR_IS_FATAL ANY
)
1 change: 1 addition & 0 deletions msvc-static-configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -204,4 +204,5 @@ execute_process(COMMAND
${APPLAUNCHER_CMAKE_GENERATOR}
-S ${CTKAppLauncher_SOURCE_DIR}
-B ${CTKAppLauncher_BUILD_DIR}
COMMAND_ERROR_IS_FATAL ANY
)
Loading