[CMake] Problems with linking on MinGW?

J Decker d3ck0r at gmail.com
Tue Jun 15 20:19:49 EDT 2010


On Tue, Jun 15, 2010 at 7:54 AM, Jesse Perla <jesseperla at gmail.com> wrote:
> I am using CMake 2.8.1 on Windows 7.  I have MinGW installed with GCC 4.5
> I have successfully compiled a library with a MinGW and cmake.  The full
> path to the library is: c:\working\etk_binaries\libetk-mgw45.a
> However, when I want to link this file into an executable (no need to have
> the CMake dependencies, etc. in projects) it can't seem to find this file.
> My cmakelists.txt is:
>   cmake_minimum_required(VERSION 2.6)
>   set(PROJECT_NAME  "test" )
>   set(SRCS  test.cpp )
>   project(${PROJECT_NAME})
>   add_executable(${PROJECT_NAME} ${SRCS})
>   link_directories( "c:/working/etk_binaries")
>   target_link_libraries(${PROJECT_NAME} libetk-mgw45)
>

PROJECT_NAME is actually a variable that gets set with project... so
this is a bit simpler...

PROJECT( "test" )
set(SRCS  test.cpp )
 add_executable(${PROJECT_NAME} ${SRCS})
......


> The error I get is:
> c:\MinGW\bin/ld.exe: cannot find -llibetk-mgw45
> collect2: ld returned 1 exit status
> mingw32-make[2]: *** [test.exe] Error 1
> mingw32-make[1]: *** [CMakeFiles/test.dir/all] Error 2
>
> Any ideas on what I have done wrong?
> Thanks,
> Jesse
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>


More information about the CMake mailing list