I am migrating a project from autotools to CMake. One part is a static library with version information and a few testprograms in a subdirectory. So I tried:
add_library(wraster STATIC ${SOURCES})
target_link_libraries(wraster PRIVATE -version-info=${WRASTER_VERSION})
add_subdirectory(tests)
and in the subdirectory:
add_executable(testdraw testdraw.c)
target_link_libraries(testdraw PRIVATE wraster)
The library gets built, but unfortunately CMake adds the linker flags from the library also to the testprograms which causes an error, because of the version information:
cc: error: unrecognized command-line option ‘-version-info=6:0:0’
(The compiler flags are set for the programs as well)
How can I avoid this without removing the version info?
TIA and best regards - Andreas