[CMake] Problems with linking on MinGW?
Hendrik Sattler
post at hendrik-sattler.de
Tue Jun 15 12:01:39 EDT 2010
Am Dienstag 15 Juni 2010, 16:54:28 schrieb Jesse Perla:
> 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)
>
>
> The error I get is:
>
> c:\MinGW\bin/ld.exe: cannot find -llibetk-mgw45
Your library name is NOT "libetk-mgw45". Try "etk-mgw45" instead and read
about library file names.
Also, do not use link_directories() but use find_library() and the value you
get from it.
HS
More information about the CMake
mailing list