Skip to content

Instantly share code, notes, and snippets.

@EmmanuelOga
Created April 8, 2017 04:48
Show Gist options
  • Save EmmanuelOga/15ce3af413f3eabde22d429571717033 to your computer and use it in GitHub Desktop.
Save EmmanuelOga/15ce3af413f3eabde22d429571717033 to your computer and use it in GitHub Desktop.
CMake: Write include paths to a file (so we can add include paths for visual studio code).
# Write the include paths to a file so we can load it into visual studio code.
# See: https://code.visualstudio.com/docs/languages/cpp#_getting-started
get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
file(WRITE "${PROJECT_BINARY_DIR}/includePaths.txt" "")
foreach(dir ${dirs})
file(APPEND "${PROJECT_BINARY_DIR}/includePaths.txt" ${dir})
file(APPEND "${PROJECT_BINARY_DIR}/includePaths.txt" "\n")
endforeach()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment