Files
qt-creator/share/qtcreator/templates/wizards/autotest/files/catch-common.pri
Christian Stenger 67ad0cf556 AutoTest: Improve Catch2 wizard
Since version 3 of Catch2 it is recommended to use the
approach to link against Catch2 instead of using a single
include.
Make both variants work. There is still a third variant of
using a single include for version 3, which is left out
here, but can easily be fixed for Catch2 users.

Change-Id: I2c25837cb1df4b460b662466dde68563fa7d713c
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-10-17 07:28:47 +00:00

22 lines
832 B
Plaintext

isEmpty(CATCH2_INSTALL_DIR):CATCH2_INSTALL_DIR=$$(CATCH2_INSTALL_DIR)
isEmpty(CATCH2_INSTALL_DIR) {
CATCH2_INSTALL_DIR = "%{CatchInstallDir}" # set by QC
!isEmpty(CATCH2_INSTALL_DIR) {
warning("Using Catch2 installation specified at Qt Creator wizard.")
message("Set CATCH2_INSTALL_DIR as environment variable or qmake variable to get rid of this message")
} else {
message("Using Catch2 from system - set CATCH2_INSTALL_DIR is it cannot be found automatically.")
}
}
!isEmpty(CATCH2_INSTALL_DIR): {
INCLUDEPATH *= "$$CATCH2_INSTALL_DIR/include"
equals(CATCH2_MAIN, 0): LIBS *= -L"$$CATCH2_INSTALL_DIR/lib" -lCatch2Main -lCatch2
else: LIBS *= -L"$$CATCH2_INSTALL_DIR/lib" -lCatch2
} else {
equals(CATCH2_MAIN, 0): LIBS *= -lCatch2Main -lCatch2
else: LIBS *= -lCatch2
}