Sysprogs forums › Forums › VisualGDB › cmake – cannot add .a library
- This topic has 3 replies, 2 voices, and was last updated 6 years, 3 months ago by support.
-
AuthorPosts
-
August 6, 2018 at 20:45 #21593b.timofteParticipant
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.cmakeThe 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 .txxCMake 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 ?
August 6, 2018 at 20:46 #21594b.timofteParticipantCorrection “The libs folder contains” should be “the BoostLibs folder contains”
August 6, 2018 at 21:14 #21595b.timofteParticipantOk
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
August 7, 2018 at 01:06 #21597supportKeymasterHi,
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.
-
AuthorPosts
- You must be logged in to reply to this topic.