-
Couldn't load subscription status.
- 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
base: main
Are you sure you want to change the base?
CMake cleanup #7658
Changes from all 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_externals_include_directories(picojson 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}) | ||
|
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. 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 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_externals_include_directories(simplecpp 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}) | ||
|
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. |
||
| 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_externals_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 ${hdrs} ${srcs}) | ||
| target_include_directories(frontend PUBLIC .) | ||
| target_link_libraries(frontend PRIVATE cppcheck-core) |
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.
This looks like we will do CLI stuff in CMake even if the CLI is disabled and that seems to defeat the purpose to disable it.
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 a dependency for dmake which seems required even if CLI is disabled.
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.
In latest HEAD I am able to build the GUI without the building CLI. Will this work still?
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.
No, because dmake requires
FileListerfrom cli library, and dmake is always built so its always needed.The previous hacks just cause a long chain of other problems and hacks. It also breaks the modularity of the components in cppcheck.
This can be solved by either moving
FileListerinto cppcheck-core or making a seperate library forFileLister. I figure this could be handled by a later PR to minimize the changes in this PR.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.
somehow .. if I compile like this:
I do not get a cppcheck binary but I do get a cppcheck-gui binary.
And I feel it's problematic if we start getting the cli binary. in qt creator I am only interested in building cppcheck-gui and nothing else.
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.
how about building dmake if cli is built. I don't know if it has to be built always.