Comments (8)
-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!
from moderncppstarter.
@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?
from moderncppstarter.
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
from moderncppstarter.
seems like
CPMAddPackage(NAME Greeter SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/..)
in test/CMakeList.txt
and documentation/CMakeList.txt
.
from moderncppstarter.
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.
from moderncppstarter.
If single header libraries
meas CPMAddPackage
can only use once, that's sad, it's very unfriendly.
from moderncppstarter.
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.
from moderncppstarter.
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.
from moderncppstarter.
Related Issues (20)
- permissive -> permissive- HOT 1
- Use `code-coverage.cmake` from `cmake-scripts` HOT 7
- `cmake --build build/docs --target GenerateDocs` not working HOT 16
- Update `PackageProject.cmake` to 1.8.0
- CMake Error at ../CMakeLists.txt:47 (add_library): HOT 1
- version.h is missing in include/greeter HOT 1
- Support sonarcloud.io HOT 1
- Use ${PROJECT_NAME} instead of writing projectname multiple times HOT 7
- Include errors HOT 13
- how to generate build file of bazel in cmake? HOT 2
- `cmake --build build/test` fails HOT 1
- GUI design HOT 1
- The GitHub workflow actions needs an update HOT 1
- configure test only does not work if CPM_USE_LOCAL_PACKAGES is TRUE
- Use of deprecated ConstructorInitializerAllOnOneLineOrOnePerLine .clang-format option HOT 3
- update get_cpm.cmake within the GitHub workflow HOT 1
- Having a issue when adding asio to my project using this template HOT 10
- Unable to open source file "doctest/doctest.h" and "cxxopts.hpp" HOT 21
- Suggestion to define main project name in a separate file HOT 1
- Misspelled "ModernCppStater" in documentation/pages/about.dox HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from moderncppstarter.