In additional project, the find_package(SustaoBasic) is OK.
When I #include "pA.h", vs reports bug:
“pA.h”: No such file or directory
But, I am sure pA.h is included in install\include, and my install\include is:
install
include
pA
pA.h
pB
pB.h
Then, I want to find solution from ITK project. I find ITK generates a ITK_INCLUDED_DIRS variable. How can I generate the similar variable in my project?
This is historical. There is no need for such a variable anymore. Instead, target_include_directories(pA PUBLIC "$<INSTALL_INTERFACE:include/pA>") is probably what you want.
After building, the vs still reports “pA.h”: No such file or directory.
I add target_include_directories(pA PUBLIC "$<INSTALL_INTERFACE:include/pA>") in the CMakeLists.txt of packageTest:
project(PackageTest)
find_package(SustaoBasic)
add_executable(PackageTest main.cpp)
target_include_directories(PackageTest PUBLIC "$<INSTALL_INTERFACE:include/pA>")
But, it still report “pA.h”: No such file or directory.
Where should I add target_include_directories(pA PUBLIC "$<INSTALL_INTERFACE:include/pA>")?
In addition, what path is INSTALL_INTERFACE? Is the SustaoBasic_DIR set in CMake?
target_include_directories(pA PUBLIC "$<INSTALL_INTERFACE:include/pA>") can solve current problem.
The include folder is:
Package
pA
pB
Is it possible to include Package directory when find_package() or target_link_libraries(PackageTest SustaoBasic)?
Currently, I must target_link_libraries(PackageTest SustaoBasic::pA) to specify the pA. Can I link all libraries, just link target_link_libraries(Pro ${ITK_LIBRARIES})?