How to include current directory using CMake
It is often helpful to include the current directory for C++ projects. When using GCC directly, this can be done usingĀ -I.
, whereas for CMake you need to use the following statement:
target_include_directories(myexe PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
Remember to replaceĀ myexe
by the name of your executable target.