Skip to content

Commit

Permalink
Simplify the target name in executable projects
Browse files Browse the repository at this point in the history
  • Loading branch information
friendlyanon committed Nov 6, 2021
1 parent bd82f35 commit 6089ad5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions cmake-init/templates/c/executable/CMakeLists.txt
Expand Up @@ -32,18 +32,18 @@ target_compile_features(%(name)s_lib PUBLIC c_std_%(std)s)

# ---- Declare executable ----

add_executable(%(name)s_%(name)s source/main.c)
add_executable(%(name)s::%(name)s ALIAS %(name)s_%(name)s)
add_executable(%(name)s_exe source/main.c)
add_executable(%(name)s::exe ALIAS %(name)s_exe)

set_target_properties(
%(name)s_%(name)s PROPERTIES
%(name)s_exe PROPERTIES
OUTPUT_NAME %(name)s
EXPORT_NAME %(name)s
EXPORT_NAME exe
)

target_compile_features(%(name)s_%(name)s PRIVATE c_std_%(std)s)
target_compile_features(%(name)s_exe PRIVATE c_std_%(std)s)

target_link_libraries(%(name)s_%(name)s PRIVATE %(name)s_lib)
target_link_libraries(%(name)s_exe PRIVATE %(name)s_lib)

# ---- Install rules ----

Expand Down
4 changes: 2 additions & 2 deletions cmake-init/templates/common/cmake/dev-mode.cmake
Expand Up @@ -5,10 +5,10 @@ endif()
{type exe}
add_custom_target(
run-exe
COMMAND %(name)s_%(name)s
COMMAND %(name)s_exe
VERBATIM
)
add_dependencies(run-exe %(name)s_%(name)s)
add_dependencies(run-exe %(name)s_exe)
{end}
option(BUILD_MCSS_DOCS "Build documentation using Doxygen and m.css" OFF)
if(BUILD_MCSS_DOCS)
Expand Down
12 changes: 6 additions & 6 deletions cmake-init/templates/executable/CMakeLists.txt
Expand Up @@ -32,18 +32,18 @@ target_compile_features(%(name)s_lib PUBLIC cxx_std_%(std)s)

# ---- Declare executable ----

add_executable(%(name)s_%(name)s source/main.cpp)
add_executable(%(name)s::%(name)s ALIAS %(name)s_%(name)s)
add_executable(%(name)s_exe source/main.cpp)
add_executable(%(name)s::exe ALIAS %(name)s_exe)

set_target_properties(
%(name)s_%(name)s PROPERTIES
%(name)s_exe PROPERTIES
OUTPUT_NAME %(name)s
EXPORT_NAME %(name)s
EXPORT_NAME exe
)

target_compile_features(%(name)s_%(name)s PRIVATE cxx_std_%(std)s)
target_compile_features(%(name)s_exe PRIVATE cxx_std_%(std)s)

target_link_libraries(%(name)s_%(name)s PRIVATE %(name)s_lib)
target_link_libraries(%(name)s_exe PRIVATE %(name)s_lib)

# ---- Install rules ----

Expand Down

0 comments on commit 6089ad5

Please sign in to comment.