init
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Close stale issues and PRs / stale (push) Successful in 13s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Close stale issues and PRs / stale (push) Successful in 13s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
This commit is contained in:
79
cmake/nice_target_sources.cmake
Normal file
79
cmake/nice_target_sources.cmake
Normal file
@@ -0,0 +1,79 @@
|
||||
# This file is part of Desktop App Toolkit,
|
||||
# a set of libraries for developing nice desktop applications.
|
||||
#
|
||||
# For license and copyright information please follow this link:
|
||||
# https://github.com/desktop-app/legal/blob/master/LEGAL
|
||||
|
||||
function(nice_target_sources target_name src_loc)
|
||||
set(writing_now "")
|
||||
set(private_sources "")
|
||||
set(public_sources "")
|
||||
set(interface_sources "")
|
||||
set(not_win_sources "")
|
||||
set(not_mac_sources "")
|
||||
set(not_linux_sources "")
|
||||
foreach (entry ${ARGN})
|
||||
if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE")
|
||||
set(writing_now ${entry})
|
||||
else()
|
||||
set(full_name ${src_loc}/${entry})
|
||||
if (${entry} MATCHES "(^|/)win/" OR ${entry} MATCHES "(^|/)winrc/" OR ${entry} MATCHES "(^|/)windows/" OR ${entry} MATCHES "[_\\/]win\\.")
|
||||
list(APPEND not_mac_sources ${full_name})
|
||||
list(APPEND not_linux_sources ${full_name})
|
||||
elseif (${entry} MATCHES "(^|/)mac/" OR ${entry} MATCHES "(^|/)darwin/" OR ${entry} MATCHES "(^|/)osx/" OR ${entry} MATCHES "[_\\/]mac\\." OR ${entry} MATCHES "[_\\/]darwin\\." OR ${entry} MATCHES "[_\\/]osx\\.")
|
||||
list(APPEND not_win_sources ${full_name})
|
||||
list(APPEND not_linux_sources ${full_name})
|
||||
elseif (${entry} MATCHES "(^|/)linux/" OR ${entry} MATCHES "[_\\/]linux\\.")
|
||||
list(APPEND not_win_sources ${full_name})
|
||||
list(APPEND not_mac_sources ${full_name})
|
||||
elseif (${entry} MATCHES "(^|/)posix/" OR ${entry} MATCHES "[_\\/]posix\\.")
|
||||
list(APPEND not_win_sources ${full_name})
|
||||
endif()
|
||||
if ("${writing_now}" STREQUAL "PRIVATE")
|
||||
list(APPEND private_sources ${full_name})
|
||||
elseif ("${writing_now}" STREQUAL "PUBLIC")
|
||||
list(APPEND public_sources ${full_name})
|
||||
elseif ("${writing_now}" STREQUAL "INTERFACE")
|
||||
list(APPEND interface_sources ${full_name})
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown sources scope for target ${target_name}")
|
||||
endif()
|
||||
if (${src_loc} MATCHES "/Resources$")
|
||||
source_group(TREE ${src_loc} PREFIX Resources FILES ${full_name})
|
||||
else()
|
||||
source_group(TREE ${src_loc} PREFIX Sources FILES ${full_name})
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if (NOT "${public_sources}" STREQUAL "")
|
||||
target_sources(${target_name} PUBLIC ${public_sources})
|
||||
endif()
|
||||
if (NOT "${private_sources}" STREQUAL "")
|
||||
target_sources(${target_name} PRIVATE ${private_sources})
|
||||
endif()
|
||||
if (NOT "${interface_sources}" STREQUAL "")
|
||||
target_sources(${target_name} INTERFACE ${interface_sources})
|
||||
endif()
|
||||
if (WIN32)
|
||||
set_source_files_properties(${not_win_sources} PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
set_source_files_properties(${not_win_sources} PROPERTIES SKIP_AUTOGEN TRUE)
|
||||
elseif (APPLE)
|
||||
set_source_files_properties(${not_mac_sources} PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
set_source_files_properties(${not_mac_sources} PROPERTIES SKIP_AUTOGEN TRUE)
|
||||
elseif (LINUX)
|
||||
set_source_files_properties(${not_linux_sources} PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
set_source_files_properties(${not_linux_sources} PROPERTIES SKIP_AUTOGEN TRUE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(remove_target_sources target_name src_loc)
|
||||
set(sources "")
|
||||
foreach (entry ${ARGN})
|
||||
set(full_name ${src_loc}/${entry})
|
||||
list(APPEND sources ${full_name})
|
||||
endforeach()
|
||||
|
||||
set_source_files_properties(${sources} PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
set_source_files_properties(${sources} PROPERTIES SKIP_AUTOGEN TRUE)
|
||||
endfunction()
|
||||
Reference in New Issue
Block a user