Skip to content

Commit

Permalink
Adding target_compile_feature support.
Browse files Browse the repository at this point in the history
  • Loading branch information
yobeonline committed Apr 24, 2022
1 parent 3064d16 commit 3c215f6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ add_target(<name>
[DEPENDENCIES <target> <lib> … ]
[OPTIONS <flag> … ]
[DEFINITIONS <define> … ]
[FEATURES <features> … ]
[BOOST_TEST <source> … ]
[GOOGLE_TEST <source> … ]
)
Expand Down Expand Up @@ -97,7 +98,8 @@ The arguments listed after each of these keywords are forwarded as is to the cor
- `INCLUDES` translates to `target_include_directories()`,
- `DEPENDENCIES` translates to `target_link_libraries()`,
- `OPTIONS` translates to `target_compile_options()`,
- and `DEFINITIONS` translates to `targetçcompile_definitions()`.
- `DEFINITIONS` translates to `target_compile_definitions()`,
- and `FEATURES` translates to `target_compile_features()`.

### Boost and Google Tests

Expand Down
6 changes: 5 additions & 1 deletion add_target.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ function(add_target target_name)

set(options "STATIC;SHARED;EXECUTALBE;HEADER_ONLY")
set(multivalue_keywords
"INCLUDES;DEPENDENCIES;OPTIONS;DEFINITIONS;BOOST_TEST;GOOGLE_TEST")
"INCLUDES;DEPENDENCIES;OPTIONS;DEFINITIONS;FEATURES;BOOST_TEST;GOOGLE_TEST"
)

cmake_parse_arguments(PARSE_ARGV 1 io1 "${options}" ""
"${multivalue_keywords}")
Expand Down Expand Up @@ -75,6 +76,9 @@ function(add_target target_name)
if(DEFINED io1_DEFINITIONS)
target_compile_definitions(${target_name} ${io1_DEFINITIONS})
endif()
if(DEFINED io1_FEATURES)
target_compile_features(${target_name} ${io1_FEATURES})
endif()
if(DEFINED io1_BOOST_TEST)
set(test_name "boost-test-${target_name}")
if(TARGET ${test_name})
Expand Down

0 comments on commit 3c215f6

Please sign in to comment.