Re: [CMake] LINK_LIBRARIES() does not respect SUFFIX/PREFIX
Great! A while ago I tried to cross-compile code for win32 with mingw from linux and ran into the same problem with the library PREFIX and SUFFIX. Setting the PREFIX and SUFFIX globally works great, cross-compiling now works good for my project (and much faster than the native compile with mingw on windows.) SET(CMAKE_STATIC_LIBRARY_PREFIX ) SET(CMAKE_STATIC_LIBRARY_SUFFIX .dll) SET(CMAKE_EXECUTABLE_SUFFIX .exe) Thanks, Peter. This problem is now solved. For anyone else facing this with crosscompiling here are is what I did. In the top level CMakeLists.txt I put in the following: PROJECT(myProj) SET(CMAKE_STATIC_LIBRARY_PREFIX lib) SET(CMAKE_STATIC_LIBRARY_SUFFIX .a) SET(CMAKE_EXECUTABLE_SUFFIX .elf) Some of my leqrnings; 1) The prefix and suffix information must and should be placed after declaring the project. If it is put before, then it gets overwritten when project is declared. Can any of the developers throw more light on the various effects that declaring a project has? 2) When cross-compiling, the CMAKE_C_COMPILER and CMAKE_CXX_COMPILER must be set *before* declaring the project. It gets *committed* when a project is declared and cannot be changed without deleting the build. Warm regards, Kishore ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
RE: [CMake] LINK_LIBRARIES() does not respect SUFFIX/PREFIX
My setup: Project/CMakeLists.txt: ADD_SUBDIRECTORY(dir) LINK_LIBRARIES(mylib) ADD_EXECUTABLE(myexec main.c) Project/dir/CMakeLists.txt: ADD_LIBRARY(mylib lib.c) SET_TARGET_PROPERTIES(mylib PROPERTIES PREFIX lib SUFFIX .a) Now while building myexec I get a link error cannot find -llibmylib.a.lib. When I do not explicitly set the prefix and suffix, I still get the error cannot find -lmylib.lib. It links fine if I go and rename the library file in the build directory. How do I solve this problem? Why is the .lib being appended in the call to the linker? Forgot to mention. I did try using TARGET_LINK_LIBRARIES() instead of LINK_LIBRARIES() to the same effect. This problem is now solved. For anyone else facing this with crosscompiling here are is what I did. In the top level CMakeLists.txt I put in the following: PROJECT(myProj) SET(CMAKE_STATIC_LIBRARY_PREFIX lib) SET(CMAKE_STATIC_LIBRARY_SUFFIX .a) SET(CMAKE_EXECUTABLE_SUFFIX .elf) Some of my leqrnings; 1) The prefix and suffix information must and should be placed after declaring the project. If it is put before, then it gets overwritten when project is declared. Can any of the developers throw more light on the various effects that declaring a project has? 2) When cross-compiling, the CMAKE_C_COMPILER and CMAKE_CXX_COMPILER must be set *before* declaring the project. It gets *committed* when a project is declared and cannot be changed without deleting the build. Warm regards, Kishore ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] LINK_LIBRARIES() does not respect SUFFIX/PREFIX
My setup: Project/CMakeLists.txt: ADD_SUBDIRECTORY(dir) LINK_LIBRARIES(mylib) ADD_EXECUTABLE(myexec main.c) Project/dir/CMakeLists.txt: ADD_LIBRARY(mylib lib.c) SET_TARGET_PROPERTIES(mylib PROPERTIES PREFIX lib SUFFIX .a) Now while building myexec I get a link error cannot find -llibmylib.a.lib. When I do not explicitly set the prefix and suffix, I still get the error cannot find -lmylib.lib. It links fine if I go and rename the library file in the build directory. How do I solve this problem? Why is the .lib being appended in the call to the linker? Warm regards, Kishore ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
RE: [CMake] LINK_LIBRARIES() does not respect SUFFIX/PREFIX
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kishore, Jonnalagadda (IE10) Sent: Wednesday, March 21, 2007 1:28 AM To: cmake@cmake.org Subject: [CMake] LINK_LIBRARIES() does not respect SUFFIX/PREFIX My setup: Project/CMakeLists.txt: ADD_SUBDIRECTORY(dir) LINK_LIBRARIES(mylib) ADD_EXECUTABLE(myexec main.c) Project/dir/CMakeLists.txt: ADD_LIBRARY(mylib lib.c) SET_TARGET_PROPERTIES(mylib PROPERTIES PREFIX lib SUFFIX .a) Now while building myexec I get a link error cannot find -llibmylib.a.lib. When I do not explicitly set the prefix and suffix, I still get the error cannot find -lmylib.lib. It links fine if I go and rename the library file in the build directory. How do I solve this problem? Why is the .lib being appended in the call to the linker? Forgot to mention. I did try using TARGET_LINK_LIBRARIES() instead of LINK_LIBRARIES() to the same effect. Warm regards, Kishore ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake