I am porting a gnu make project to CMake. Initially I am using the Ninja generator and running in Ubuntu 18.04.
The project consists of a static library 'libKernel.a', which includes main.cpp, which we link into an executable: 'MyApp'. The program dynamically loads shared libraries that need objects from 'libKernel.a' so we use options such as -whole-archive and -export-dynamic.
The CMake build is failing to link at runtime as some symbols are missing.
I have two issues here:
1) In the CMake implementation I removed main.cpp from libKernel and specified it as the executable source file, as it seems that the executable needs at least one SOURCE file. Is there a way around this?
2) How can I tell CMake to use the '-Wl,-whole-archive,-export-dynamic,--no-as-needed' flags?