cmake

Creating C# and C++/CLR projects in the same solution using CMake (CMake targeting visual studio)

放肆的年华 提交于 2021-01-28 14:00:06
问题 I want to create a solution in MSVC using CMake that has two projects (in CMake vocabulary one C# executive and one C++/CLR library). How can I do this? All examples that I found are about one type of project in a CMake (all C++ or C#). To clarify: If I want to create a C++/CLR project using CMake, I can write code like this: cmake_minimum_required (VERSION 3.5) project (TestCppClr) if (NOT MSVC) message(FATAL_ERROR "This CMake files only wirks with MSVC.") endif(NOT MSVC) ADD_EXECUTABLE

How do I introduce find_dependency calls into my generated foo-config.cmake file?

﹥>﹥吖頭↗ 提交于 2021-01-28 13:41:29
问题 I have a CMake project named foo . In its CMakeLists.txt , and among other commands, I have: install( EXPORT foo_export DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/foo" NAMESPACE "foo::" FILE foo-config.cmake ) (and also a write_basic_package_version_file() call later on.) Now, I want foo-config.cmake to also check for a dependency bar of foo , with find_dependency() . How do I do that, other than by replacing the .cmake file generation with something manual? Notes: I'm interested both in the

undefined reference to `omp_get_wtime'

橙三吉。 提交于 2021-01-28 12:05:38
问题 i learn c++, OpenMP. I have tried compile my program with omp_get_wtime and it doesn't work, but when i deleted this, it works. i must add something, but what and where. In openmptryflags or Cmakelists? snap/clion/61/bin/cmake/linux/bin/cmake --build /home/bapah/CLionProjects/omp1/cmake-build-debug --target omp1 -- -j 6 [ 50%] Linking CXX executable omp1 CMakeFiles/omp1.dir/main.cpp.o: In function `main': /home/bapah/CLionProjects/omp1/main.cpp:36: undefined reference to `omp_get_wtime'

Convert qmake into CMake

会有一股神秘感。 提交于 2021-01-28 11:37:07
问题 I am new to CMake, but I used to use qmake. In my qmake, I have the following for adding a static library that is inside a folder called bin, inside the project folder: QT -= gui QT += core CONFIG += c++11 console CONFIG -= app_bundle DEFINES += QT_DEPRECATED_WARNINGS SOURCES += \ main.cpp macx: LIBS += -L$$PWD/bin/lib/ -lnanomsg INCLUDEPATH += $$PWD/bin/include DEPENDPATH += $$PWD/bin/include macx: PRE_TARGETDEPS += $$PWD/bin/lib/libnanomsg.a What is the corresponding CMake syntax? I tried

glog doesn't compile on Windows with MinGW

心不动则不痛 提交于 2021-01-28 11:30:17
问题 It seems that glog doesn't compile on Windows with MinGW. Cmake configuration and generation is OK, but when I start the mingw32-make.exe -j10 command, I get a lot of errors related with ambiguity declarations. This is the complete cmake configure and generate command output: D:\INSTALL\Development\lib\ceres-mingw\glog\build>"D:\Program Files\CMake\bin\cmake.exe" -G "MinGW Makefiles" -Dgflags_DIR="D:\INSTALL\Development\lib\ceres-mingw\gflags\build" .. -- The C compiler identification is GNU

Linking errors for Qt and cvv when building OpenCV in Windows 10

|▌冷眼眸甩不掉的悲伤 提交于 2021-01-28 11:06:15
问题 I am trying to build OpenCV according to these instructions. After generating with CMake I opened OpenCV.sln in the build folder, switched to Release mode and built ALL_BUILD successfully. But when I try to build the INSTALL option under CMake, I get errors like this: Error LNK2001 unresolved external symbol "public: virtual struct QMetaObject const * __cdecl cvv::qtutil::Signal::metaObject(void)const " Error LNK2019 unresolved external symbol "public: void __cdecl cvv::qtutil::ZoomableImage:

CTest can not find executable file

随声附和 提交于 2021-01-28 10:50:48
问题 I have a question about starting the ctest. As I can understand that ctest uses CTestTestfile.cmake for the beginning of the unit test. What is the executable file? Why does ctest find it as *.exe if it is a CTestTestfile.cmake? What is wrong in my actions? I have a folder Prj: and folder /build with cmake output (CTestTestfile.cmake is here) as well as all ctest,cmake , etc. programs with their dll (is it right?). Here is the text of CMakeLists.txt file: cmake_minimum_required(VERSION 2.8)

What is wrong with my installation of glfw3?

て烟熏妆下的殇ゞ 提交于 2021-01-28 10:14:13
问题 I tried to build glfw but something seems wrong with my installation with cmake under windows. I tried to do the following steps to build the glfw-library with cmake: git clone https://github.com/glfw/glfw cd glfw mkdir build-MinGW32 cd build-MinGW32 I then produced the build system "MinGW Makefiles" with cmake giving it the source directory (not the src folder) of the glfw repository: $ cmake -G "MinGW Makefiles" ../ Result of former: -- The C compiler identification is GNU 6.3.0 -- Check

How do I make clion work with following make and pkg-config?

拟墨画扇 提交于 2021-01-28 09:57:07
问题 I have following simple C program which notifies me on which workspace I am in Xfce. I can successfully compile it and use it with a command gcc -O2 -DWNCK_I_KNOW_THIS_IS_UNSTABLE -o wsnd pkg-config --cflags --libs libnotify --libs libwnck-1.0 wsn.c But how would I set Cmake configuration file so clion would compile it also? How do I use pkg-config with Cmake? #include <libnotify/notify.h> #include <libwnck-3.0/libwnck/libwnck.h> #define N_SUMMARY "Workspace Changed" #define N_ICON "dialog

How to auto-link boost libraries with CMake

蹲街弑〆低调 提交于 2021-01-28 09:52:44
问题 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($