Answer the question
In order to leave comments, you need to log in
How to understand target_include_directories() (C without ++ / CMake / mingw-w64 / CLion / Windows)?
Hey! I'm doing Gui and I need to connect the library to CMake, but I can't (
In my question they said it was needed target_include_directories()
, but I didn't understand anything from the official manual.
I write in 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
)
And they tell me:"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]
Or:"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
What to do :(?
Answer the question
In order to leave comments, you need to log in
target_include_directories( GuiTEST PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/libs/wxWidgets-3.1.1/include
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question