I’m newly going through the updated Tutorial. It’s much improved.
After completing exercise 2 I tried to build but got this error:
CMake Error at CMakeLists.txt:49 (install):
install TARGETS target MathFunctions is exported but not all of its
interface file sets are installed
A bit lost, I looked at the solution. It showed I needed to add FILE_SET HEADERS.
However, I could not see in ‘Step 9: Installation Commands and Concepts’ any reference to using ‘FILE_SET HEADERS’ when exporting targets. The example given is:
install(
TARGETS MyApp MyLib
EXPORT MyProjectTargets
)
The solution has the form:
install(
TARGETS MyApp MyLib
EXPORT MyProjectTargets
FILE_SET HEADERS
)
I see that in the reference documentation that ‘install(TARGETS)’ can take ‘artifact-kinds’ including FILE_SET. But it would not occur to me (a beginner) that you have to export it.
There’s no mention of this in the introductory text in this tutorial step.
If CMake thinks I’ve made a mistake by omitting ‘FILE_SET HEADERS’, then why is that not just added by default? What if I don’t want to export those HEADERS, just the executable, and the library file (as some private library used by the executable)?