Clean up InitSharedLibrary.cmake

This commit is contained in:
John Colvin committed 2024-08-10 03:21:06 +00:00
1 parent 511bfe0aee
commit 87bbc3bab2
1 file changed
+2 -5
+2 -5
View File
@@ -1,7 +1,3 @@
function(set_parent_scope VAR_NAME)
set(${VAR_NAME} ${${VAR_NAME}} PARENT_SCOPE)
endfunction()
function(init_shared_library)
set(source_dir)
if (${ARGC} EQUAL 0)
@@ -20,12 +16,13 @@ function(init_shared_library)
# set(${PROJECT_NAME}_Sources ${${PROJECT_NAME}_Sources} PARENT_SCOPE)
# Note: cpp files inside 'tests' dir(s) are considered tests.
# Remove tests from main sources, and add them to test sources
set(${PROJECT_NAME}_Test_Sources PARENT_SCOPE)
set(${PROJECT_NAME}_Test_Sources)
foreach(item ${${PROJECT_NAME}_Sources})
if(${item} MATCHES "tests/*.cpp")
list(REMOVE_ITEM ${PROJECT_NAME}_Sources ${item})
list(APPEND ${PROJECT_NAME}_Test_Sources ${item})
endif()
set(${PROJECT_NAME}_Test_Sources ${${PROJECT_NAME}_Test_Sources} PARENT_SCOPE)
endforeach()
# Add main library