I am using CMake 2.8.8 and the ExternalProject module. CMake retrieves the project’s source files and builds them correctly (resulting in project.a and project.so files on unix). I want to always go with the dynamic library. How can I do that and still be cross platform?
I tried
list(
APPEND foo_LIBRARIES
${binary_dir}/${CMAKE_FIND_LIBRARY_PREFIXES}project${CMAKE_FIND_LIBRARY_SUFFIXES}
)
but that does not work because {CMAKE_FIND_LIBRARY_SUFFIXES} is a list of .a;.so.
list(
APPEND foo_LIBRARIES
${binary_dir}/${CMAKE_FIND_LIBRARY_PREFIXES}project.so
)
works, but only on unix systems. Is there a clean way to achieve this?
Given that for
WIN32the${CMAKE_FIND_LIBRARY_SUFFIXES}is just.lib, you could do something like: