mirror-chatterino2/tests/CMakeLists.txt
Rasmus Karlsson 9d6238687e Move property-changing from root CMakeLists.txt file to src/ one
Perform same properties cmake stuff on the tests project

Remove output directory stuff
2021-03-07 11:14:49 +01:00

83 lines
2.6 KiB
CMake

include(GoogleTest)
project(chatterino-test)
set(main_dir ${CMAKE_SOURCE_DIR}/src)
include_directories(${main_dir})
set(chatterino_SOURCES
${main_dir}/common/NetworkRequest.cpp
${main_dir}/common/NetworkResult.cpp
${main_dir}/common/NetworkPrivate.cpp
${main_dir}/common/NetworkManager.cpp
${main_dir}/common/QLogging.cpp
${main_dir}/common/Modes.cpp
${main_dir}/common/ChatterinoSetting.cpp
${main_dir}/util/DebugCount.cpp
${main_dir}/singletons/Paths.cpp
${main_dir}/BaseSettings.cpp
${main_dir}/common/UsernameSet.cpp
${main_dir}/controllers/highlights/HighlightPhrase.cpp
${main_dir}/providers/emoji/Emojis.cpp
${main_dir}/messages/Emote.cpp
${main_dir}/messages/Image.cpp
${main_dir}/messages/ImageSet.cpp
${main_dir}/util/RapidjsonHelpers.cpp
${CMAKE_SOURCE_DIR}/resources/resources.qrc
${CMAKE_SOURCE_DIR}/resources/resources_autogenerated.qrc
)
message("++ Tests enabled")
add_executable(${PROJECT_NAME}
${chatterino_SOURCES}
src/main.cpp
src/NetworkRequest.cpp
src/UsernameSet.cpp
src/HighlightPhrase.cpp
src/Emojis.cpp
)
target_link_libraries(${PROJECT_NAME}
Qt5::Core
Qt5::Widgets
Qt5::Network
Qt5::Concurrent
)
if (USE_PACKAGE_MANAGER)
target_link_libraries(${PROJECT_NAME}
CONAN_PKG::gtest
CONAN_PKG::serialize
CONAN_PKG::settings
CONAN_PKG::signals
)
else ()
target_link_libraries(${PROJECT_NAME}
gtest gtest_main
Pajlada::Serialize
Pajlada::Settings
Pajlada::Signals
Threads::Threads
)
endif ()
target_compile_definitions(${PROJECT_NAME} PRIVATE CHATTERINO CHATTERINO_TEST UNICODE AB_CUSTOM_THEME AB_CUSTOM_SETTINGS IRC_STATIC IRC_NAMESPACE=Communi)
target_compile_definitions(${PROJECT_NAME} PRIVATE CHATTERINO_GIT_HASH=\"${GIT_HASH}\" CHATTERINO_GIT_RELEASE=\"${GIT_RELEASE}\" CHATTERINO_GIT_COMMIT=\"${GIT_COMMIT}\")
if (WIN32)
target_compile_definitions(${PROJECT_NAME} PRIVATE USEWINSDK)
endif ()
set_target_properties(${PROJECT_NAME}
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/bin"
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/bin"
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/bin"
)
#gtest_discover_tests(${PROJECT_NAME})