Skip to content

Commit 983ec56

Browse files
authored
Merge pull request #69 from blshkv/fix-setup-compiler
cmake: fix setup_compiler by wrapping Compiler.cmake in a function
2 parents fcff014 + b1e1b65 commit 983ec56

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

cmake/Compiler.cmake

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
set_target_properties(${PROJECT_NAME}
1+
function(setup_compiler TARGET)
2+
set_target_properties(${TARGET}
23
PROPERTIES
34
EXPORT_COMPILE_COMMANDS ON
45
CXX_STANDARD_REQUIRED YES
56
CXX_EXTENSIONS NO
67
CXX_STANDARD 17
78
)
89

9-
target_compile_features(${PROJECT_NAME}
10+
target_compile_features(${TARGET}
1011
PRIVATE
1112
cxx_std_17
1213
)
@@ -54,14 +55,15 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
5455
)
5556
endif()
5657

57-
target_compile_options(${PROJECT_NAME}
58+
target_compile_options(${TARGET}
5859
PRIVATE
5960
$<$<CXX_COMPILER_ID:MSVC>:${MSVC_COMPILE_OPTIONS}>
6061
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:${NOT_MSVC_COMPILE_OPTIONS}>
6162
)
6263

63-
target_link_options(${PROJECT_NAME}
64+
target_link_options(${TARGET}
6465
PUBLIC
6566
$<$<CXX_COMPILER_ID:MSVC>:${MSVC_LINK_OPTIONS}>
6667
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:${NOT_MSVC_LINK_OPTIONS}>
6768
)
69+
endfunction()

0 commit comments

Comments
 (0)