[CMake] Why are my static libs not being read?

John Drescher drescherjm at gmail.com
Tue Jul 31 14:15:59 EDT 2012


> The qt libraries are included in the target link flag (this project uses qt
> of course), however the two lib files that exist in the lib folder in the
> same directory are either not recognized. They draw up linker issues in the
> compiler, even though I can tell through the cmake gui that it does find
> those paths.
>
> Any input at all would be great. Below I have included the CMakeLists.txt, a
> screenshot of the cmake gui as well as a sample of the linking errors being
> drawn.
>
> PROJECT(CppSampleQt01)
> FIND_PACKAGE(Qt4 REQUIRED)
>
> //These are the lines I am concerned do not function appropriately. However
> you can  http://i.imgur.com/EDrHR.png see here  that they are recognized by
> CMake
> FIND_LIBRARY(SIMPLONLIB lv.simplon lib)
> FIND_LIBRARY(SIMPLONIMGPROC lv.simplon.imgproc lib)
>
> SET(CppSampleQt01_SOURCES include/lv.simplon.class.cpp camera.cpp main.cpp
> mainwindow.cpp osdep.cpp paint.cpp)
> SET(CppSampleQt01_HEADERS include/lv.simplon.class.h camera.h mainwindow.h
> osdep.h paint.h)
> SET(CppSampleQt01_RESOURCES icons.qrc)
>
> INCLUDE(${QT_USE_FILE})
> ADD_DEFINITIONS(${QT_DEFINITIONS})
>
> ADD_EXECUTABLE(CppSampleQt01 ${CppSampleQt01_SOURCES}
>                                 ${CppSampleQt01_HEADERS_MOC}
>                                 ${CppSampleQt01_RESOURCES_RCC})
>
> TARGET_LINK_LIBRARIES(CppSampleQt01 ${QT_LIBRARIES})

You need to add your 2 libraries in TARGET_LINK_LIBRARIES. CMake will
not do that automatically.

John


More information about the CMake mailing list