Skip to content

Commit bdcd7ff

Browse files
committed
Qt Gui: Minor modification to CMakeLists.txt, automoc cannot be a target property
1 parent 6c91e51 commit bdcd7ff

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

CMakeLists.txt

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ else()
3333
-Wpedantic # warn if non-standard C++ is used
3434
-Wconversion # warn on type conversions that may lose data
3535
-Wsign-conversion # warn on sign conversions
36-
-Wmisleading-indentation # warn if identation implies blocks where blocks
36+
#-Wmisleading-indentation # warn if identation implies blocks where blocks
3737
# do not exist
38-
-Wduplicated-cond # warn if if / else chain has duplicated conditions
39-
-Wduplicated-branches # warn if if / else branches have duplicated code
38+
#-Wduplicated-cond # warn if if / else chain has duplicated conditions
39+
#-Wduplicated-branches # warn if if / else branches have duplicated code
4040
-Wlogical-op # warn about logical operations being used where bitwise were
4141
# probably wanted
42-
-Wnull-dereference # warn if a null dereference is detected
42+
#-Wnull-dereference # warn if a null dereference is detected
4343
-Wuseless-cast # warn if you perform a cast to the same type
4444
-Wdouble-promotion # warn if float is implicit promoted to double
4545
-Wformat=2 # warn on security issues around functions that format output
@@ -48,37 +48,46 @@ else()
4848
endif()
4949

5050
add_executable(intro main.cpp)
51-
target_compile_features(intro PRIVATE cxx_std_17)
51+
#target_compile_features(intro PRIVATE cxx_std_14)
5252
target_link_libraries(intro PRIVATE project_warnings --coverage)
5353

54-
#qt
55-
find_package( Qt5Widgets REQUIRED )
56-
set( CMAKE_AUTOMOC ON )
57-
add_executable( helloQt qt/qtMain.cpp qt/HelloQt.cpp )
58-
target_link_libraries( helloQt Qt5::Widgets )
59-
target_compile_features( helloQt PUBLIC cxx_nullptr )
60-
6154
enable_testing()
6255

6356
add_executable(tester tester.cpp)
6457
target_link_libraries(tester PRIVATE project_warnings --coverage)
6558

6659
add_test(Tester tester)
6760

61+
#qt
62+
if( DEFINED CPP_STARTER_USE_QT )
63+
message( "Using Qt" )
64+
find_package( Qt5Widgets REQUIRED )
65+
set( CMAKE_AUTOMOC ON )
66+
add_executable( helloQt qt/qtMain.cpp qt/HelloQt.cpp )
67+
#set_target_properties( helloQt PROPERTIES CMAKE_AUTOMOC ON )
68+
target_link_libraries( helloQt Qt5::Widgets )
69+
target_compile_features( helloQt PUBLIC cxx_nullptr cxx_lambdas )
70+
endif()
71+
6872
#fltk test
73+
if( DEFINED CPP_STARTER_USE_FLTK )
6974
find_package(FLTK REQUIRED)
7075
add_executable(test_fltk fltk/test_fltk.cpp)
7176
target_link_libraries(test_fltk PRIVATE project_warnings ${FLTK_LIBRARIES})
7277
target_include_directories(test_fltk PRIVATE ${FLTK_INCLUDE_DIR})
78+
endif()
7379

7480
# gtkmm test
81+
if( DEFINED CPP_STARTER_USE_GTKMM )
7582
find_package(PkgConfig REQUIRED)
7683
pkg_check_modules(GTKMM REQUIRED gtkmm-3.0)
7784
add_executable(test_gtkmm gtkmm/main.cpp gtkmm/hello_world.cpp)
7885
target_link_libraries(test_gtkmm PRIVATE project_warnings ${GTKMM_LIBRARIES})
7986
target_include_directories(test_gtkmm PRIVATE ${GTKMM_INCLUDE_DIRS})
87+
endif()
8088

8189
# imgui example
90+
if( DEFINED CPP_STARTER_USE_IMGUI )
8291
find_package(SFML COMPONENTS graphics window system)
8392
find_package(OpenGL)
8493

@@ -90,8 +99,10 @@ target_link_libraries(imgui INTERFACE ${SFML_LIBRARIES} ${OPENGL_gl_LIBRARY})
9099
add_executable(test_imgui imgui/test.cpp)
91100
target_link_libraries(test_imgui PRIVATE project_warnings imgui)
92101
target_include_directories(test_imgui PRIVATE ${SFML_INCLUDE_DIR})
102+
endif()
93103

94-
# Nana
104+
## Nana
105+
if( DEFINED CPP_STARTER_USE_NANA )
95106
include(ExternalProject)
96107
ExternalProject_add(
97108
Nana
@@ -106,5 +117,4 @@ ExternalProject_Get_Property(Nana SOURCE_DIR BINARY_DIR)
106117
add_executable(test_nana nana/main.cpp)
107118
target_include_directories(test_nana PRIVATE ${SOURCE_DIR}/include)
108119
target_link_libraries(test_nana PRIVATE ${BINARY_DIR}/libnana.so ${NANA_LINKS})
109-
110-
120+
endif()

0 commit comments

Comments
 (0)