I have ExternalProject that builds static library libfoo.a
My shared library is linked with foo.a using:
target_link_libraries ( proj PRIVATE <FULL_PATH>/libfoo.a )
But, I get an error:
ninja: error: ‘<FULL_PATH>/libfoo.a’, needed by ‘libproj.so’, missing and no known rule to make it
I tried to use:
set_source_files_properties ( <FULL_PATH>/libfoo.a PROPERTIES GENERATED TRUE )
but this did not help
Ninja sees the path and doesn’t know that the external project will build it, so it errors. You’d need to inform that the path is an output of the relevant
ExternalProject somehow. I don’t think there’s a way to do this today though.
ExternalProject in with regular
add_library calls doesn’t work too well. I’d recommend using
libfoo is not a CMake project then there’s always the superbuild pattern also.