I think I have found a way to work round this. Instead of trying to get a
list of all the static libraries that a target will link against I will
modify the various libraries so that they add their library dependencies
like this:
target_link_libraries(mtx_wrapper PUBLIC
$<$,SHARED_LIBRARY>:-
Well try it and see if it works. If you set this variable in a specific
CMakeLists file, it will affect the specific add_library (or
add_executable) that is in that CMakeLists file. With this way you can
control which libraries/executables will be linked with these flags, and
this is the level of c
The problem is that I need to add both -whole-archive and -no-whole-archive
options. And I need to control exactly where they occur so that only my
libraries occur inside the whole archive section. I'd be happy to be
proven wrong but I don't think setting CMAKE_EXE_LINKER_FLAGS will give me
that
Hi Glenn,
Adding linker flags exactly in target_link_libraries is not a very good
practice in my opinion. To add specific linker flags to an executable, you
can use the variable CMAKE_EXE_LINKER_FLAGS, which you can edit before
calling add_executable. You could set this variable accordingly in you
Don't all shout at once :-) I'm guessing there are no easy solutions
then...
--
Glenn
On 28 June 2014 14:33, Glenn Coombs wrote:
> I have a project which compiles and links into both a stand alone
> executable and a dynamic shared library. The library and the executable
> link against the sa
I have a project which compiles and links into both a stand alone
executable and a dynamic shared library. The library and the executable
link against the same project libraries but have different object files
containing their entry points: main.o for the executable and dll_main.o for
the library.