Closed navono closed 3 years ago
-DCMAKE_BUILD_TYPE=Debug
should help.
But CLion
does not work correctly with an CMake Project
.
Try it with Qt-creator
, which allow you to change the CMake
options and show the Project structure
much better!
@ClausKlein thank you for response.
I modify some config in conan_integrate branch in my forked project, standalone and library worked, but test
and documentation
still failed if add it to root CMakeList.txt
add_subdirectory(app)
add_subdirectory(Greeter)
add_subdirectory(test)
#add_subdirectory(documentation)
with error:
CMake Error at app/CMakeLists.txt:35 (add_executable):
add_executable cannot create target "App" because another target with the
same name already exists. The existing target is an executable created in
source directory "/mnt/d/sourcecode/cpp/ModernCppStarter/app". See
documentation for policy CMP0002 for more details.
any suggestion?
with --debug-output
mode:
CMake Error at app/CMakeLists.txt:35 (add_executable):
add_executable cannot create target "App" because another target with the
same name already exists. The existing target is an executable created in
source directory "/mnt/d/sourcecode/cpp/ModernCppStarter/app". See
documentation for policy CMP0002 for more details.
Called from: [1] /mnt/d/sourcecode/cpp/ModernCppStarter/app/CMakeLists.txt
Returning to /mnt/d/sourcecode/cpp/ModernCppStarter
Called from: [1] /mnt/d/sourcecode/cpp/ModernCppStarter/CMakeLists.txt
Entering /mnt/d/sourcecode/cpp/ModernCppStarter/Greeter
Called from: [1] /mnt/d/sourcecode/cpp/ModernCppStarter/CMakeLists.txt
...
CMake Error at Greeter/CMakeLists.txt:40 (add_library):
add_library cannot create target "Greeter" because another target with the
same name already exists. The existing target is a static library created
in source directory "/mnt/d/sourcecode/cpp/ModernCppStarter/Greeter". See
documentation for policy CMP0002 for more details.
Called from: [1] /mnt/d/sourcecode/cpp/ModernCppStarter/Greeter/CMakeLists.txt
Returning to /mnt/d/sourcecode/cpp/ModernCppStarter
Called from: [1] /mnt/d/sourcecode/cpp/ModernCppStarter/CMakeLists.txt
Entering /mnt/d/sourcecode/cpp/ModernCppStarter/test
Called from: [1] /mnt/d/sourcecode/cpp/ModernCppStarter/CMakeLists.txt
seems like
CPMAddPackage(NAME Greeter SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/..)
in test/CMakeList.txt
and documentation/CMakeList.txt
.
Dit you read the README.md
?
The template should be used for a single library project only. If you need to build more than one lib, you should use this template multiple times for each library.
Do not use add_subdirectories()
!
It can't work with this template.
If single header libraries
meas CPMAddPackage
can only use once, that's sad, it's very unfriendly.
If
single header libraries
measCPMAddPackage
can only use once, that's sad, it's very unfriendly.
That is neither true nor unfriendly! You can't create with CMake 2 targets with same name.
If you want to change the concept
behind the ModernCppStarter Template
, it is possible.
see for example
But read and understand the CMake Doku!
CPMAddPackage
is used within this project. But is independent of it.
That is neither true nor unfriendly!
You're right, because I lack enough understanding of CMake, I will read the Doc and check your example code.
Thank you.
As I opened starter with CLion, I can't find binary in configuration. CLion Settings: CMake: CMake options: -Hall -Bbuild Build directory: build.
Only
Greeter
andfmt
shows in Debug configuration, How to configure to debug the binary module?