-
Notifications
You must be signed in to change notification settings - Fork 1.5k
CMake cleanup #7658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CMake cleanup #7658
Changes from 12 commits
a72f0e8
7536500
9524828
aae3fa0
e5f8f8c
599a54e
74f853f
91afb23
00c462a
0e7f402
ca5c192
be40581
e690613
151d3d0
0276fd8
25d8719
f95486d
5416baa
063a2f8
5a27cca
a4b579d
c645209
b8bd740
f211acd
5c47f9e
8193d33
56c3699
872f922
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
|
|
||
| add_library(picojson INTERFACE) | ||
| target_include_directories(picojson SYSTEM INTERFACE .) | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,11 @@ | ||
| file(GLOB hdrs "*.h") | ||
| file(GLOB srcs "*.cpp") | ||
|
|
||
| add_library(simplecpp_objs OBJECT ${srcs} ${hdrs}) | ||
| if (BUILD_CORE_DLL) | ||
| target_compile_definitions(simplecpp_objs PRIVATE SIMPLECPP_EXPORT) | ||
| endif() | ||
| add_library(simplecpp ${srcs} ${hdrs}) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be able to become a shared library.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It will if we set
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Then everything becomes a shared library which is not what we want. IMO the shared library stuff in the Windows build should be completely dropped. And I still thing this should not be real libraries since they are not actually reusable. |
||
| target_dll_compile_definitions(simplecpp EXPORT SIMPLECPP_EXPORT IMPORT SIMPLECPP_IMPORT) | ||
|
|
||
| if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||
| target_compile_options_safe(simplecpp_objs -Wno-zero-as-null-pointer-constant) | ||
| target_compile_options_safe(simplecpp -Wno-zero-as-null-pointer-constant) | ||
| endif() | ||
|
|
||
| target_include_directories(simplecpp SYSTEM PUBLIC .) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,24 +1,24 @@ | ||
| file(GLOB hdrs "*.h") | ||
| file(GLOB srcs "*.cpp") | ||
|
|
||
| add_library(tinyxml2_objs OBJECT ${srcs} ${hdrs}) | ||
| if (BUILD_CORE_DLL) | ||
| target_compile_definitions(tinyxml2_objs PRIVATE TINYXML2_EXPORT) | ||
| endif() | ||
| add_library(tinyxml2 ${srcs} ${hdrs}) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be able to become a shared library.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That should have said "should not be able". |
||
| target_dll_compile_definitions(tinyxml2 EXPORT TINYXML2_EXPORT IMPORT TINYXML2_IMPORT) | ||
|
|
||
| # TODO: needs to be fixed upstream | ||
| if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") | ||
| target_compile_options(tinyxml2_objs PRIVATE -Wno-suggest-attribute=format) | ||
| target_compile_options(tinyxml2_objs PRIVATE -Wno-useless-cast) | ||
| target_compile_options(tinyxml2 PRIVATE -Wno-suggest-attribute=format) | ||
| target_compile_options(tinyxml2 PRIVATE -Wno-useless-cast) | ||
| endif() | ||
| if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||
| target_compile_options_safe(tinyxml2_objs -Wno-implicit-fallthrough) | ||
| target_compile_options_safe(tinyxml2_objs -Wno-suggest-destructor-override) | ||
| target_compile_options_safe(tinyxml2_objs -Wno-zero-as-null-pointer-constant) | ||
| target_compile_options_safe(tinyxml2_objs -Wno-format-nonliteral) | ||
| target_compile_options_safe(tinyxml2_objs -Wno-inconsistent-missing-destructor-override) | ||
| target_compile_options_safe(tinyxml2 -Wno-implicit-fallthrough) | ||
| target_compile_options_safe(tinyxml2 -Wno-suggest-destructor-override) | ||
| target_compile_options_safe(tinyxml2 -Wno-zero-as-null-pointer-constant) | ||
| target_compile_options_safe(tinyxml2 -Wno-format-nonliteral) | ||
| target_compile_options_safe(tinyxml2 -Wno-inconsistent-missing-destructor-override) | ||
| endif() | ||
| if(CYGWIN) | ||
| target_compile_definitions(-D_LARGEFILE_SOURCE) # required for fseeko() and ftello() | ||
| endif() | ||
|
|
||
| target_include_directories(tinyxml2 PUBLIC .) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| file(GLOB hdrs "*.h") | ||
| file(GLOB srcs "*.cpp") | ||
|
|
||
| add_library(frontend_objs OBJECT ${hdrs} ${srcs}) | ||
| target_include_directories(frontend_objs PRIVATE ${PROJECT_SOURCE_DIR}/lib) | ||
| add_library(frontend OBJECT ${hdrs} ${srcs}) | ||
|
||
| target_include_directories(frontend PUBLIC .) | ||
| target_link_libraries(frontend PRIVATE cppcheck-core) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,10 +6,6 @@ qt_wrap_cpp(test-resultstree_SRC | |
| ${CMAKE_SOURCE_DIR}/gui/threadhandler.h | ||
| ${CMAKE_SOURCE_DIR}/gui/threadresult.h | ||
| ) | ||
| if(USE_BUNDLED_TINYXML2) | ||
| list(APPEND test-resultstree_SRC $<TARGET_OBJECTS:tinyxml2_objs>) | ||
| endif() | ||
| list(APPEND test-resultstree_SRC $<TARGET_OBJECTS:simplecpp_objs> $<TARGET_OBJECTS:cppcheck-core>) | ||
| add_custom_target(build-resultstree-deps SOURCES ${test-resultstree_SRC}) | ||
| add_dependencies(gui-build-deps build-resultstree-deps) | ||
| add_executable(test-resultstree | ||
|
|
@@ -21,22 +17,14 @@ add_executable(test-resultstree | |
| ${CMAKE_SOURCE_DIR}/gui/report.cpp | ||
| ${CMAKE_SOURCE_DIR}/gui/xmlreportv2.cpp | ||
| ) | ||
| target_include_directories(test-resultstree PRIVATE ${CMAKE_SOURCE_DIR}/gui ${CMAKE_SOURCE_DIR}/lib) | ||
| target_externals_include_directories(test-resultstree PRIVATE ${CMAKE_SOURCE_DIR}/externals/simplecpp) | ||
| if(USE_BUNDLED_TINYXML2) | ||
| target_externals_include_directories(test-resultstree PRIVATE ${PROJECT_SOURCE_DIR}/externals/tinyxml2/) | ||
| else() | ||
| target_include_directories(test-resultstree SYSTEM PRIVATE ${tinyxml2_INCLUDE_DIRS}) | ||
| endif() | ||
| target_include_directories(test-resultstree PRIVATE ${CMAKE_SOURCE_DIR}/gui) | ||
| target_link_libraries(test-resultstree cppcheck-core simplecpp tinyxml2) | ||
| if (HAVE_RULES) | ||
| target_link_libraries(test-resultstree ${PCRE_LIBRARY}) | ||
| target_include_directories(test-resultstree SYSTEM PRIVATE ${PCRE_INCLUDE}) | ||
| endif() | ||
| target_compile_definitions(test-resultstree PRIVATE SRCDIR="${CMAKE_CURRENT_SOURCE_DIR}") | ||
| target_link_libraries(test-resultstree ${QT_CORE_LIB} ${QT_GUI_LIB} ${QT_WIDGETS_LIB} ${QT_TEST_LIB}) | ||
| if(tinyxml2_FOUND AND NOT USE_BUNDLED_TINYXML2) | ||
| target_link_libraries(test-resultstree ${tinyxml2_LIBRARIES}) | ||
| endif() | ||
|
|
||
| if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||
| if(QT_VERSION VERSION_LESS "6.0.0") | ||
|
|
@@ -51,6 +39,12 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") | |
| target_compile_options_safe(test-resultstree -Wno-missing-noreturn) | ||
| endif() | ||
|
|
||
| if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") | ||
| # caused by mocks | ||
| target_compile_options_safe(test-resultstree -Wno-suggest-attribute=noreturn) | ||
| endif() | ||
|
|
||
|
|
||
|
||
| if (REGISTER_GUI_TESTS) | ||
| # TODO: might crash - see #13223 | ||
| #add_test(NAME test-resultstree COMMAND $<TARGET_FILE:test-resultstree> -platform offscreen) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes (among others) in
macos-15builds:Failing builds on warnings is tracked via https://trac.cppcheck.net/ticket/12021.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its needed to fix CI, because they became errors in the CI with these changes. I am not sure why it didnt error out before in the CI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The scope is getting way too big with a lot of questionable sidecar changes. This needs to be fixed more incrementally.
That should not be happening. That indicates that something is wrong in these CMake change.