Created
November 6, 2017 22:35
-
-
Save domargan/2a7fa793ada4ce2789c5885d7a2c427d to your computer and use it in GitHub Desktop.
One (hacky) CMakeLists.txt to rule them all...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Credits: sakra @ https://stackoverflow.com/a/6925256 | |
cmake_minimum_required(VERSION 3.0) | |
project (Foo) | |
file(GLOB_RECURSE Foo_SOURCES "src/*.cpp") | |
file(GLOB_RECURSE Foo_HEADERS "src/*.h") | |
set (Foo_INCLUDE_DIRS "") | |
foreach (_headerFile ${Foo_HEADERS}) | |
get_filename_component(_dir ${_headerFile} PATH) | |
list (APPEND Foo_INCLUDE_DIRS ${_dir}) | |
endforeach() | |
list(REMOVE_DUPLICATES Foo_INCLUDE_DIRS) | |
add_executable (FooExe ${Foo_SOURCES}) | |
target_include_directories(FooExe PRIVATE ${Foo_INCLUDE_DIRS}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment