Comments (5)
install(TARGETS my_foundation PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/include/my_foundation)
You are copying it wrong. Please copy my CMakeLists.txt
on top of yours. Or omit the ${CMAKE_INSTALL_INCLUDEDIR}
, which is creating a double include
folder
from conan.
Or omit the ${CMAKE_INSTALL_INCLUDEDIR}, which is creating a double include folder
I understand that with this change it worked? 🙂
Happy if that is the case, thanks for the feedback!
from conan.
Thanks for your question.
I hope my internal library in src would consume the include/my_foundation/my_algorithm.h file without the my_foundation namespace like this
I'd like to challenge this. In my experience (not talking about Conan specifically, but as a C++ developer for decades), it is almost always better to use the same #include
paths both in development and for final consumption. The build systems and compilers "include paths" definition allows to have this easily.
Otherwise, this is mostly a CMake question, not a Conan one. You had:
install(TARGETS my_foundation
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/include/my_foundation # NOT WORKING
)
Use this CMakeLists.txt
:
cmake_minimum_required(VERSION 3.15)
project(mypkg CXX)
add_library(mypkg src/mypkg.cpp)
target_include_directories(mypkg PUBLIC include)
set_target_properties(mypkg PROPERTIES PUBLIC_HEADER "include/mypkg.h")
install(TARGETS mypkg PUBLIC_HEADER DESTINATION include/myfolder)
And change the test_package
include to #include "myfolder/mypkg.h"
and it will work.
Please try that and let me know.
from conan.
Hi @memsharded.
Thank you for your quick response.
I updated my code based on your recommendation and still have some issues.
cpp-namespacing/test_package/src/example.cpp:1:10: fatal error: 'my_foundation/my_algorithm.h' file not found
#include "my_foundation/my_algorithm.h"
Seems the test_package
cannot find my header files and the install(TARGETS my_foundation PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/include/my_foundation)
is not copying the include
directory to the build/Release
folder.....
I have updated my code to Here
from conan.
Thank you for your advice. It is working.
from conan.
Related Issues (20)
- [bug] unable to install openssl/3.2.1 recipe with conan version: 2.0.17 HOT 4
- [question] autotools with CFLAGS/LDFLAGS HOT 5
- [question] How to Conan download binaries and find binaries HOT 5
- Cache Gets wrong package[bug] HOT 8
- How can I read CPPFLAGS HOT 17
- [question] Recommended way of calling conan from python program HOT 8
- [question] Problem deploying oneMKL prepackaged binaries in custom package HOT 21
- [bug] tools.build:compiler_executables won't work with Meson due to spaces in the compiler path HOT 5
- Cannot install qt 6.7.0 prebuilt binary on Windows HOT 4
- [question] How to use editable library with cmake's conan provider file HOT 2
- [bug] `qt` install broken since 2.3.0 HOT 2
- [question] How can I not export sources when creating a package and publishing it HOT 3
- [question] Compatibility Issues HOT 5
- Conan CLI: Add option to conan remove to just skip without error if package does not exist HOT 2
- [feature] expose CMakeToolchain conf to be able to set CMAKE_GENERATOR_INSTANCE HOT 1
- conan export-pkg command not passing --version to the recipe with Conan 2.2.3 HOT 8
- [question] Revision mismatch between OSes HOT 1
- [bug] detect_api.detect_clang_compiler provides the minor version of the compiler HOT 4
- SSLError: HTTPSConnectionPool HOT 2
- [question] "control" cmake include dir variable HOT 7
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 conan.