Привет! Делаю Gui и нужно подключить библиотеку в CMake, но никак(
В моём
вопросе сказали, что нужен
target_include_directories()
, но по официальному мануалу ничего не понял.
Пишу в CMakeLists.txt:
cmake_minimum_required(VERSION 3.10)
project(GuiTEST C)
set(CMAKE_C_STANDARD 11)
add_executable(GuiTEST main.c)
target_include_directories ( GuiTEST PUBLIC
$< BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}libs/wxWidgets-3.1.1/include >
$< INSTALL_INTERFACE:libs/wxWidgets-3.1.1/include > # <prefix>/include/mylib
)
А мне говорят:
"C:\Program Files\JetBrains\CLion 2018.1.5\bin\cmake\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - MinGW Makefiles" C:\Users\Timoshka-WIN10\Documents\CLionProjects\GuiTEST
-- Configuring done
CMake Error at CMakeLists.txt:8 (target_include_directories):
Error evaluating generator expression:
$<;C:/Users/Timoshka-WIN10/Documents/CLionProjects/GuiTEST/BUILD_INTERFACE:C:/Users/Timoshka-WIN10/Documents/CLionProjects/GuiTESTlibs/wxWidgets-3.1.1/include;C:/Users/Timoshka-WIN10/Documents/CLionProjects/GuiTEST/>
Expression did not evaluate to a known generator expression
CMake Error at CMakeLists.txt:8 (target_include_directories):
Error evaluating generator expression:
$<;C:/Users/Timoshka-WIN10/Documents/CLionProjects/GuiTEST/BUILD_INTERFACE:C:/Users/Timoshka-WIN10/Documents/CLionProjects/GuiTESTlibs/wxWidgets-3.1.1/include;C:/Users/Timoshka-WIN10/Documents/CLionProjects/GuiTEST/>
Expression did not evaluate to a known generator expression
CMake Error at CMakeLists.txt:8 (target_include_directories):
Error evaluating generator expression:
$<;C:/Users/Timoshka-WIN10/Documents/CLionProjects/GuiTEST/BUILD_INTERFACE:C:/Users/Timoshka-WIN10/Documents/CLionProjects/GuiTESTlibs/wxWidgets-3.1.1/include;C:/Users/Timoshka-WIN10/Documents/CLionProjects/GuiTEST/>
Expression did not evaluate to a known generator expression
CMake Error at CMakeLists.txt:8 (target_include_directories):
Error evaluating generator expression:
$<;C:/Users/Timoshka-WIN10/Documents/CLionProjects/GuiTEST/BUILD_INTERFACE:C:/Users/Timoshka-WIN10/Documents/CLionProjects/GuiTESTlibs/wxWidgets-3.1.1/include;C:/Users/Timoshka-WIN10/Documents/CLionProjects/GuiTEST/>
Expression did not evaluate to a known generator expression
-- Generating done
-- Build files have been written to: C:/Users/Timoshka-WIN10/Documents/CLionProjects/GuiTEST/cmake-build-debug
[Failed to reload]
Или:
"C:\Program Files\JetBrains\CLion 2018.1.5\bin\cmake\bin\cmake.exe" --build C:\Users\Timoshka-WIN10\Documents\CLionProjects\GuiTEST\cmake-build-debug --target all -- -j 1
Scanning dependencies of target GuiTEST
[ 50%] Building C object CMakeFiles/GuiTEST.dir/main.c.obj
C:\Users\Timoshka-WIN10\Documents\CLionProjects\GuiTEST\main.c:3:10: fatal error: wx/wxprec.h: No such file or directory
#include <wx/wxprec.h>
^~~~~~~~~~~~~
compilation terminated.
mingw32-make.exe[2]: *** [CMakeFiles\GuiTEST.dir\build.make:62: CMakeFiles/GuiTEST.dir/main.c.obj] Error 1
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:67: CMakeFiles/GuiTEST.dir/all] Error 2
mingw32-make.exe: *** [Makefile:83: all] Error 2
Что делать :(?