File: CMakeLists.txt

package info (click to toggle)
qtbase-opensource-src 5.15.15%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 350,700 kB
  • sloc: cpp: 2,089,913; ansic: 336,851; xml: 115,491; python: 9,447; java: 7,499; asm: 4,023; perl: 2,047; sh: 2,037; yacc: 1,687; lex: 1,333; javascript: 878; makefile: 273; objc: 70
file content (50 lines) | stat: -rw-r--r-- 1,454 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

cmake_minimum_required(VERSION 2.8)

project(no_link_gui)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

if (EXISTS "${CMAKE_CURRENT_LIST_DIR}/FindPackageHints.cmake")
    include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHints.cmake")
endif()

find_package(Qt5Gui REQUIRED HINTS ${Qt5Tests_PREFIX_PATH})
find_package(Qt5Test REQUIRED HINTS ${Qt5Tests_PREFIX_PATH})

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}")

include_directories(
    ${Qt5Gui_INCLUDE_DIRS}
    ${Qt5Test_INCLUDE_DIRS}
)

add_definitions(
    ${Qt5Gui_DEFINITIONS}
    ${Qt5Test_DEFINITIONS}
)

set(main_file "main.cpp")
set(moc_file "${CMAKE_CURRENT_BINARY_DIR}/main.moc")

qt5_generate_moc("${main_file}" "${moc_file}")

# The core_test is expected to fail to build because
# QT_GUI_LIB is defined, which affects the contents of
# Qt Test and the definition of QTEST_MAIN.
# If running this test manually (ctest -V -R no_link_gui from
# the tests/auto/cmake/build directory), the core_test is
# expected to fail to link because of missing symbols from Qt GUI.
# The gui_test is expected to build successfully  (though it may
# be necessary to comment out the core_test and re-run cmake)
add_executable(core_test "${main_file}" "${moc_file}")
target_link_libraries(core_test
    ${Qt5Core_LIBRARIES}
    ${Qt5Test_LIBRARIES}
)

add_executable(gui_test "${main_file}" "${moc_file}")
target_link_libraries(gui_test
    ${Qt5Gui_LIBRARIES}
    ${Qt5Test_LIBRARIES}
)