1
2# Turn off any compile groups with unfulfilled external library dependencies
3foreach(group ${MUQ_GROUPS})
4    foreach(depend ${${group}_REQUIRES})
5        #if(NOT MUQ_USE_${depend})
6        #    message(STATUS "Turning off ${group} because of a missing library dependency.")
7        #    set(MUQ_ENABLEGROUP_${group} OFF)
8        #endif()
9    endforeach()
10endforeach()
11
12# Turn off any compile groups whose upstream compile groups are off
13foreach(group ${MUQ_GROUPS})
14    foreach(depend ${${group}_REQUIRES_GROUPS})
15        if(MUQ_ENABLEGROUP_${group} AND NOT MUQ_ENABLEGROUP_${depend})
16            message(STATUS "Turning off ${group} because of a missing upstream group dependency (${depend}).")
17            set(MUQ_ENABLEGROUP_${group} OFF)
18        endif()
19    endforeach()
20endforeach()
21
22# Create a list of all MUQ libraries to build
23set(MUQ_TARGETS )
24foreach(group ${MUQ_GROUPS})
25    if(MUQ_ENABLEGROUP_${group})
26        list(APPEND MUQ_TARGETS ${${group}_LIBRARY})
27    endif()
28endforeach()
29list(REMOVE_DUPLICATES MUQ_TARGETS)
30
31# Set up the source for each target library
32foreach(target ${MUQ_TARGETS})
33    set(${target}_SOURCES )
34
35    foreach(group ${MUQ_GROUPS})
36        if(MUQ_ENABLEGROUP_${group})
37	    if(${${group}_LIBRARY} STREQUAL ${target})
38
39                # Check to see if a group has any source (e.g., *.cpp) files.  Flag it as something that will be built if it does.
40	        list(LENGTH ${group}_SOURCES sources_length)
41		if(sources_length GREATER 0)
42	            set(${group}_IS_COMPILED ON CACHE INTERNAL "Whether or not the ${group} is used in any library.")
43		endif()
44
45	        list(APPEND ${target}_SOURCES ${${group}_SOURCES})
46	    endif()
47	endif()
48    endforeach()
49
50    if(${target}_SOURCES)
51        list(REMOVE_DUPLICATES ${target}_SOURCES)
52    endif()
53
54endforeach()
55