cmake

How to auto-link boost libraries with CMake

心不动则不痛 提交于 2021-01-28 09:43:47
问题 project(learn) cmake_minimum_required(VERSION 3.11) set(CMAKE_CXX_STANDARD 17) if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") message("Current OS is Linux") include_directories("/mnt/e/c++/boost_1_72_0") link_directories("/mnt/e/c++/boost_1_72_0/stage/lib") link_libraries(pthread boost_thread boost_fiber boost_context) elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") message("Current OS is Windows") include_directories("E:/c++/boost_1_72_0") link_directories("E:/c++/boost_1_72_0/stage/lib") endif($

cmake : shared library : how to get the .lib name instead of .dll name?

耗尽温柔 提交于 2021-01-28 09:20:32
问题 Under Windows, with cmake I generate a shared library and an executable. The shared lib generate 2 files, a .DLL and a .LIB I use add_custom_command with $<TARGET_FILE:mylibname> , this output the name of the .DLL file. But, I need the name of the .LIB file. How can I do ? Any idea ? 回答1: Just found how, maybe it will be useful for someone else, so I share. Simply use TARGET_LINKER_FILE instead of TARGET_FILE ! 来源: https://stackoverflow.com/questions/48545720/cmake-shared-library-how-to-get

CMake Error while using find_package(Boost … ) in CMakeLists.txt: No suitable build variant has been found

删除回忆录丶 提交于 2021-01-28 09:09:52
问题 When using CMake, I get the following error when calling find_package(Boost 1.6 COMPONENTS program_options thread system REQUIRED) : -- Boost include dirs: C:/dev/boost/include/boost-1_72 -- Boost libraries: Boost library -- Found Boost 1.72.0 at C:/dev/boost/lib/cmake/Boost-1.72.0 -- Requested configuration: QUIET REQUIRED COMPONENTS program_options;thread;system -- BoostConfig: find_package(boost_headers 1.72.0 EXACT CONFIG REQUIRED QUIET HINTS C:/dev/boost/lib/cmake) -- BoostConfig: find

Cmake when building LLVM

╄→гoц情女王★ 提交于 2021-01-28 07:09:35
问题 Trying to build llvm project LLVM Project with CMake, it gives me an error that I can't solve by my own. For doing this, I am using an Ubuntu Virtual Machine (version 18.04) and I am trying to build the project with "ninja". I have tried to build this with the following commands (which the LLVM Builder Guide says to use, https://llvm.org/docs/GettingStarted.html) git clone https://github.com/llvm/llvm-project.git cd llvm-project/ mkdir build && cd build cmake -DLLVM_ENABLE_PROJECTS='all'

gmake: *** No rule to make target (install cmake on gitbash, do not have makefile)

半腔热情 提交于 2021-01-28 07:07:17
问题 I d like to install cmake on gitbash (Windows 10) , because I need it o run shiny-server. https://github.com/rstudio/shiny-server/wiki/Building-Shiny-Server-from-Source#what-if-a-sufficiently-recent-version-of-cmake-isnt-available When I run ./configure , it gives me the following error *CMake 3.15.2, Copyright 2000-2019 Kitware, Inc. and Contributors C compiler on this system is: tcc C++ compiler on this system is: C:\MinGW\bin\g++.exe C:\MinGW\bin\g++.exe Makefile processor on this system

Undefined references to OpenGL on Ubuntu

青春壹個敷衍的年華 提交于 2021-01-28 06:48:00
问题 I'm getting all these undefined references: Linking CXX executable SimpleGavam ../../lib/local/Gavam/libGavam.a(MeshUtils.cpp.o): In function `Gavam::DrawMesh(cv::Mat_<float>&, cv::Mat_<float> const&, cv::Mat_<int> const&, cv::Vec<double, 6> const&, double, double, double, double, cv::Size_<int> const&, double, double)': /home/samuel/Clm-Z/lib/local/Gavam/src/MeshUtils.cpp:189: undefined reference to `glutSwapBuffers' ../../lib/local/Gavam/libGavam.a(MeshUtils.cpp.o): In function `Gavam:

Make References like Visual Studio in CMake

陌路散爱 提交于 2021-01-28 06:35:36
问题 I start to use CMake recently and I starting to get used to the program. I managed to generate two Visual Studio solutions/projects: a shared library (core.dll) and a static library (zlib.lib). Now I still have a problem, my core.dll library makes references to the zlib library in Visual Studio. (In Properties -> Common Properties -> References). How can I reproduce this? Here is how my files are located: project ---core ------src ------CMakeLists.txt ---external ------zlib ------CMakeLists

qmake to Cmake transition: syntax for external librairies

亡梦爱人 提交于 2021-01-28 06:08:21
问题 For a specific project I am moving out of qmake and now have to use cmake. My path are the following: Source : ~/Projects/Project External static library (OSVR in this instance) paths : ~/osvr/lib/ , ~/osvr/include/osvr /osvr/include/jsoncpp Using qmake, the linking part to that library used to be: INCLUDEPATH += /usr/include LIBS += -L$$PWD/../../osvr/lib/ -losvrClientKit -losvrClient -losvrCommon -losvrUtil -ljsoncpp INCLUDEPATH += $$PWD/../../osvr/include/ INCLUDEPATH += $$PWD/../..

Cannot compile SFML project using cmake

那年仲夏 提交于 2021-01-28 06:06:52
问题 I am trying to set up a new c++/sfml project using cmake/g++ on windows but the build keeps on failing with linking errors. There are still errors if I use SFML_STATIC or not. I have looked up the problem but none of the answers so far remove the errors. - \build - \cmake_modules - FindSFML.cmake - \SFML - CMakeLists.txt - config.h.in - main.cpp CMakeLists.txt cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR) project(myproject) set(myproject_VERSION_MAJOR 1) set(myproject_VERSION_MINOR 0)

how to link .so files with CMake [duplicate]

こ雲淡風輕ζ 提交于 2021-01-28 06:04:39
问题 This question already has answers here : cmake and libpthread (4 answers) Undefined reference to pthread_create in Linux (14 answers) Closed 2 days ago . I want to rebuild a simple application based on a .cpp, a .h and multiple .so files. From what i've seen, my CMakeLists.txt should be like this : cmake_minimum_required(VERSION 3.5) set(CMAKE_CXX_STANDARD 11) project(test C CXX) add_executable(${PROJECT_NAME} main.cpp) target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_SOURCE_DIR}/lib