cmake – cannot add .a library

Sysprogs forums Forums VisualGDB cmake – cannot add .a library

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #21593
    b.timofte
    Participant

    I have  a project with folder structure:

    BoostLibs\
    CMakeLists.txt
    {contains}
    cmake_minimum_required(VERSION 2.7)
    add_library(libboost_filesystem libboost_filesystem-mgw49-mt-d-1_63.cxx)
    target_link_libraries(libboost_filesystem)

    VisualGDB\
    VisualGDBCache\
    AUT_4_2_XmlReader.cpp
    AUT_4_2_XmlReader.vgdbcmake
    CMakeLists.txt

    {contains}

    cmake_minimum_required(VERSION 2.7)
    project(AUT_4_2_XmlReader)
    set(LIBRARIES_FROM_REFERENCES “”)
    add_executable(AUT_4_2_XmlReader AUT_4_2_XmlReader.cpp)
    target_include_directories(AUT_4_2_XmlReader PRIVATE d:/Kit/Boost/boost_1_63_0)
    target_link_libraries(AUT_4_2_XmlReader “${LIBRARIES_FROM_REFERENCES}”)
    set(CMAKE_CXX_FLAGS “${CMAKE_CXX_FLAGS} -std=gnu++11 -std=gnu++11”)
    set_property(TARGET AUT_4_2_XmlReader PROPERTY CXX_STANDARD 11)
    add_subdirectory(BoostLibs)
    toolchain.cmake

     

    The libs folder contains

    libboost_filesystem-mgw49-mt-d-1_63.a

    When i try to build i get cmake error in libs\cmakelist.txt

    add_library(libboost_filesystem libboost_filesystem-mgw49-mt-d-1_63.cxx)

     

    CMake Error at BoostLibs/CMakeLists.txt:5 (add_library):
    Cannot find source file:

    libboost_filesystem-mgw49-mt-d-1_63.cxx

    Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
    .hxx .in .txx

    CMake Error: Cannot determine link language for target “libboost_filesystem”.
    CMake Error: CMake can not determine linker language for target: libboost_filesystem
    Generating done
    Exception reported by CMake server: Failed to compute build system.
    w22+n1: Exception reported by CMake server: Failed to compute build system.
    at w22.e[_InType,_OutType](_InType a)
    at w22.o1(String a)
    at sf2.l_2(Hello a)

     

    Any help how to link this .a lib to the main .exe ?

     

     

    #21594
    b.timofte
    Participant

    Correction “The libs folder contains” should be “the BoostLibs folder contains”

    #21595
    b.timofte
    Participant

    Ok

    I fixed the error by making cmakelists.txt in root as:

     

    cmake_minimum_required(VERSION 2.7)
    project(AUT_4_2_XmlReader)
    set(BOOST_FILE_SYSTEM “${CMAKE_SOURCE_DIR}/BoostLibs/libboost_filesystem-mgw49-mt-d-1_63.a”)
    set(BOOST_SYSTEM “${CMAKE_SOURCE_DIR}/BoostLibs/libboost_system-mgw49-mt-d-1_63.a”)
    add_executable(AUT_4_2_XmlReader AUT_4_2_XmlReader.cpp)
    target_include_directories(AUT_4_2_XmlReader PRIVATE d:/Kit/Boost/boost_1_63_0)
    target_link_libraries(AUT_4_2_XmlReader ${BOOST_FILE_SYSTEM} ${BOOST_SYSTEM})
    set(CMAKE_CXX_FLAGS “${CMAKE_CXX_FLAGS} -std=gnu++11 -std=gnu++11”)
    set_property(TARGET AUT_4_2_XmlReader PROPERTY CXX_STANDARD 11)
    add_subdirectory(BoostLibs)

     

    and the one in boostlibs as

    #Generated by VisualGDB project wizard.
    #Note: VisualGDB will automatically update this file when you add new sources to the project.

    cmake_minimum_required(VERSION 2.7)

     

    I am not sure this is the recommended way though … Any hints so i dont break VisualGDB with these manual changes

    #21597
    support
    Keymaster

    Hi,

    If you are using the Advanced CMake Project Subsystem, CMake directly reports a detailed project structure to VisualGDB, so as long as CMake can handle it, VisualGDB will work with it as well.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.