I discovered this only yesterday but if you include another CMake project in your own (like users of this API will in their code) the variables of the child project will be overwritten by the parent when using:
add_subdirectory(/path/to/cppAPI)
and so CMAKE_SOURCE_DIR will point to the parent project, not the API anymore. Same applies to PROJECT_NAME taking the name of the parent project.
Need to use CMAKE_CURRENT_SOURCE_DIR and switch PROJECT_NAME to adding set( FDPAPI fdpapi ) and replacing PROJECT_NAME then with FDPAPI.
I discovered this only yesterday but if you include another CMake project in your own (like users of this API will in their code) the variables of the child project will be overwritten by the parent when using:
and so
CMAKE_SOURCE_DIR
will point to the parent project, not the API anymore. Same applies toPROJECT_NAME
taking the name of the parent project.Need to use
CMAKE_CURRENT_SOURCE_DIR
and switchPROJECT_NAME
to addingset( FDPAPI fdpapi )
and replacingPROJECT_NAME
then withFDPAPI
.