cmake

How to run SFML in CLion, Error undefined reference to?

我们两清 提交于 2020-07-17 10:47:14
问题 I'm new to C++ and try to learn game programming, I choose SFML and run on CLion by Jetbrain and using Ubuntu machine. I following this tutorial SFML and Linux here my code : #include <SFML/Graphics.hpp> using namespace sf; int main() { RenderWindow window(sf::VideoMode(200, 200), "SFML Work!"); CircleShape shape(100.f); shape.setFillColor(Color::Green); while (window.isOpen()) { Event event; while (window.pollEvent(event)) { if (event.type == Event::Closed) { window.close(); } } window.clear

Check where include/library path variables like OpenCV_LIBS point to in unix

╄→гoц情女王★ 提交于 2020-07-17 10:22:22
问题 When using some libraries like OpenCV with C/C++, variables like OpenCV_LIBS are used to point the compiler/linker to the relevant directories. Examples using cmake: include_directories( ${OpenCV_INCLUDE_DIRS} ) target_link_libraries( project_name ${OpenCV_LIBS} ) How can I check where such variables point at? I've tried typing set or printenv in terminal but it shows only some system variables. Also how can I set/change such variables? 回答1: Those variables are determined by cmake (see

Check where include/library path variables like OpenCV_LIBS point to in unix

孤者浪人 提交于 2020-07-17 10:20:10
问题 When using some libraries like OpenCV with C/C++, variables like OpenCV_LIBS are used to point the compiler/linker to the relevant directories. Examples using cmake: include_directories( ${OpenCV_INCLUDE_DIRS} ) target_link_libraries( project_name ${OpenCV_LIBS} ) How can I check where such variables point at? I've tried typing set or printenv in terminal but it shows only some system variables. Also how can I set/change such variables? 回答1: Those variables are determined by cmake (see

Calling C code from C++ in a CMake project. Undefined symbol. Have extern C

£可爱£侵袭症+ 提交于 2020-07-16 10:29:47
问题 I'm trying to build a CMake project that calls C code from C++, and I'm getting undefined symbols, even though I'm (AFAIK) properly using "extern C". CMakeLists.txt: cmake_minimum_required(VERSION 3.0) project(CTest LANGUAGES CXX) add_executable(test main.cpp lib.c) main.cpp: #include "lib.h" int main() { printit(); return 0; } lib.c: #include <stdio.h> #include "lib.h" int printit() { printf("Hello world\n"); return 0; } lib.h: extern "C" int printit(); That gives me an "undefined reference

How to specify the output directory of a given DLL?

安稳与你 提交于 2020-07-16 08:26:52
问题 I'm using the following src/CMakeLists.txt : cmake_minimum_required(VERSION 3.1.0) project(foo) add_library(foo SHARED foo.cpp) set_target_properties(foo PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/$<CONFIG>/subdir ) And on Windows, I'm building the library using: mkdir build cd build cmake ../src cmake --build . Output File: ~/build/Debug/foo.dll Expected Output File: ~/build/Debug/subdir/foo.dll What am I doing wrong? It works fine on platforms other than Windows, and it seems

Using FetchContent_Declare together with CMAKE_ARGS

时光毁灭记忆、已成空白 提交于 2020-07-16 05:59:09
问题 I'm using cmake v3.13 and I want to change my ExternalProject_Add() for the SEAL library to: include(FetchContent) # Get the seal library set(SEAL "seal") FetchContent_Declare( ${SEAL} GIT_REPOSITORY https://github.com/microsoft/SEAL GIT_TAG v3.5.2 ) FetchContent_GetProperties(${SEAL}) if(NOT ${SEAL}_POPULATED) FetchContent_Populate(${SEAL}) add_subdirectory(${${SEAL}_SOURCE_DIR} ${${SEAL}_BINARY_DIR}) endif() When I was using ExternalProject_Add() I've used CMAKE_ARGS -DBUILD_SHARED_LIBS=ON

CMake command is not recognized

烈酒焚心 提交于 2020-07-15 17:11:26
问题 I have installed CMake and cmake.exe is in C:\Program Files (x86)\CMake\bin But when I run call cmake %CMAKE_BUILD_OPTIONS% through a bat file I am getting an error message 'cmake' is not recognized as an internal or external command, operable program or batch file. Should I set this path in environment variable? 回答1: It resolved after adding C:\Program Files (x86)\CMake\bin to environment variable PATH . 回答2: Was able to resolve the issue by installing Chocolatey (on Windows 10) and running

CMake command is not recognized

人走茶凉 提交于 2020-07-15 17:09:52
问题 I have installed CMake and cmake.exe is in C:\Program Files (x86)\CMake\bin But when I run call cmake %CMAKE_BUILD_OPTIONS% through a bat file I am getting an error message 'cmake' is not recognized as an internal or external command, operable program or batch file. Should I set this path in environment variable? 回答1: It resolved after adding C:\Program Files (x86)\CMake\bin to environment variable PATH . 回答2: Was able to resolve the issue by installing Chocolatey (on Windows 10) and running

How do I include RealSense2/OpenCV source into compilation with CMake?

99封情书 提交于 2020-07-10 08:37:06
问题 SHORT VERSION I want to bundle the (uncompiled) source files for OpenCV and librealsense2 with CMake so I can cross compile it on RPi (or at all), but I am new to CMake and don't know how. add_executable (CMakeRealSense "CMakeRealSense.cpp" "CMakeRealSense.h") include_directories(opencv libs/opencv-master/include) include_directories(realsense2 libs/librealsense-master/include) This gives a bunch of errors related to RS files itself (X not declared on scope). LONG VERSION I am currently

Unable to build Binary for target dso_dataset (libgdcmMSFF.so.2.8 Undefined refernce) and conflict with libraries in implicit directories

不羁的心 提交于 2020-07-10 06:54:18
问题 I am trying to build a binary target called dso_dataset. I follow this Github page to run some software. I faced a warning while cmake .. but ignored and went on to do make, but at the end recipe for target failed. output of command cmake .. is below (base) gok4abt@ABTZ0KUV:~/dso/build$ sudo cmake .. -- The C compiler identification is GNU 7.5.0 -- The CXX compiler identification is GNU 7.5.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works --