[CMake] How to import platform-independent library with add_library()?

Reza Housseini reza.housseini at gmx.ch
Fri Dec 14 05:16:40 EST 2012


Hello Guys

I try to import a library and was now wondering if there's a
platform-independent way?
Here's my code:

  add_library(mylib SHARED IMPORTED)
  set_target_properties(mylib PROPERTIES
    IMPORTED_LOCATION ${CPPLIB_DIR}/libmylib.so)

But now what about using this CMakeLists.txt file under Windows? Can't
I just specifie a path? When I do so I get the following error message
from the linker:

  /usr/bin/ld: cannot find ../../core/build: File format not recognized

So he is just linking the path instead of the library.

Thanks for your help!
Cheers Reza


More information about the CMake mailing list