1
0
Fork 0

Use ARGN where applicable

This commit is contained in:
Ilya Fedin 2023-05-31 08:33:32 +04:00 committed by John Preston
parent a20e3a1349
commit 1c07a71d6f
7 changed files with 12 additions and 34 deletions

View file

@ -13,10 +13,8 @@ function(init_target_folder target_name folder_name)
endfunction() endfunction()
function(init_target target_name) # init_target(my_target [cxx_std_..] folder_name) function(init_target target_name) # init_target(my_target [cxx_std_..] folder_name)
set(argslist ${ARGV})
list(REMOVE_AT argslist 0)
set(standard ${MAXIMUM_CXX_STANDARD}) set(standard ${MAXIMUM_CXX_STANDARD})
foreach (entry ${argslist}) foreach (entry ${ARGN})
if (${entry} STREQUAL cxx_std_14 OR ${entry} STREQUAL cxx_std_11 OR ${entry} STREQUAL cxx_std_17) if (${entry} STREQUAL cxx_std_14 OR ${entry} STREQUAL cxx_std_11 OR ${entry} STREQUAL cxx_std_17)
set(standard ${entry}) set(standard ${entry})
else() else()

View file

@ -5,9 +5,6 @@
# https://github.com/desktop-app/legal/blob/master/LEGAL # https://github.com/desktop-app/legal/blob/master/LEGAL
function(nice_target_sources target_name src_loc) function(nice_target_sources target_name src_loc)
set(list ${ARGV})
list(REMOVE_AT list 0 1)
set(writing_now "") set(writing_now "")
set(private_sources "") set(private_sources "")
set(public_sources "") set(public_sources "")
@ -15,7 +12,7 @@ function(nice_target_sources target_name src_loc)
set(not_win_sources "") set(not_win_sources "")
set(not_mac_sources "") set(not_mac_sources "")
set(not_linux_sources "") set(not_linux_sources "")
foreach (entry ${list}) foreach (entry ${ARGN})
if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE") if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE")
set(writing_now ${entry}) set(writing_now ${entry})
else() else()
@ -71,11 +68,8 @@ function(nice_target_sources target_name src_loc)
endfunction() endfunction()
function(remove_target_sources target_name src_loc) function(remove_target_sources target_name src_loc)
set(list ${ARGV})
list(REMOVE_AT list 0 1)
set(sources "") set(sources "")
foreach (entry ${list}) foreach (entry ${ARGN})
set(full_name ${src_loc}/${entry}) set(full_name ${src_loc}/${entry})
list(APPEND sources ${full_name}) list(APPEND sources ${full_name})
endforeach() endforeach()

View file

@ -7,14 +7,11 @@
include(CheckCXXCompilerFlag) include(CheckCXXCompilerFlag)
function(target_compile_options_if_exists target_name) function(target_compile_options_if_exists target_name)
set(list ${ARGV})
list(REMOVE_AT list 0)
set(writing_now "") set(writing_now "")
set(private_options "") set(private_options "")
set(public_options "") set(public_options "")
set(interface_options "") set(interface_options "")
foreach (entry ${list}) foreach (entry ${ARGN})
if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE") if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE")
set(writing_now ${entry}) set(writing_now ${entry})
else() else()

View file

@ -5,15 +5,11 @@
# https://github.com/desktop-app/legal/blob/master/LEGAL # https://github.com/desktop-app/legal/blob/master/LEGAL
function(target_link_frameworks_generic type target_name) function(target_link_frameworks_generic type target_name)
set(list ${ARGV})
list(REMOVE_AT list 1)
list(REMOVE_AT list 0)
set(writing_now "") set(writing_now "")
set(private_frameworks "") set(private_frameworks "")
set(public_frameworks "") set(public_frameworks "")
set(interface_frameworks "") set(interface_frameworks "")
foreach (entry ${list}) foreach (entry ${ARGN})
if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE") if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE")
set(writing_now ${entry}) set(writing_now ${entry})
else() else()
@ -41,10 +37,10 @@ function(target_link_frameworks_generic type target_name)
endif() endif()
endfunction() endfunction()
function(target_link_frameworks target_name) function(target_link_frameworks)
target_link_frameworks_generic("-framework" ${ARGV}) target_link_frameworks_generic("-framework" ${ARGN})
endfunction() endfunction()
function(target_link_frameworks_weak target_name) function(target_link_frameworks_weak)
target_link_frameworks_generic("-weak_framework" ${ARGV}) target_link_frameworks_generic("-weak_framework" ${ARGN})
endfunction() endfunction()

View file

@ -7,14 +7,11 @@
include(CheckCXXCompilerFlag) include(CheckCXXCompilerFlag)
function(target_link_options_if_exists target_name) function(target_link_options_if_exists target_name)
set(list ${ARGV})
list(REMOVE_AT list 0)
set(writing_now "") set(writing_now "")
set(private_options "") set(private_options "")
set(public_options "") set(public_options "")
set(interface_options "") set(interface_options "")
foreach (entry ${list}) foreach (entry ${ARGN})
if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE") if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE")
set(writing_now ${entry}) set(writing_now ${entry})
else() else()

View file

@ -5,14 +5,11 @@
# https://github.com/desktop-app/legal/blob/master/LEGAL # https://github.com/desktop-app/legal/blob/master/LEGAL
function(target_link_static_libraries target_name) function(target_link_static_libraries target_name)
set(list ${ARGV})
list(REMOVE_AT list 0)
set(writing_now "") set(writing_now "")
set(private_libs "") set(private_libs "")
set(public_libs "") set(public_libs "")
set(interface_libs "") set(interface_libs "")
foreach (entry ${list}) foreach (entry ${ARGN})
if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE") if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE")
set(writing_now ${entry}) set(writing_now ${entry})
else() else()

View file

@ -5,8 +5,7 @@
# https://github.com/desktop-app/legal/blob/master/LEGAL # https://github.com/desktop-app/legal/blob/master/LEGAL
function(target_add_resource target_name) function(target_add_resource target_name)
set(list ${ARGV}) set(list ${ARGN})
list(REMOVE_AT list 0)
target_sources(${target_name} PRIVATE ${list}) target_sources(${target_name} PRIVATE ${list})
get_target_property(existing_resources ${target_name} RESOURCE) get_target_property(existing_resources ${target_name} RESOURCE)
if (NOT "${existing_resources}" STREQUAL "existing_resources-NOTFOUND") if (NOT "${existing_resources}" STREQUAL "existing_resources-NOTFOUND")