upm/examples/c++/CMakeLists.txt
Noel Eck 048f1ac08e examples: C/C++ examples use transitive dependencies
Updated the examples to comprehend transitive dependencies.  This means
that each example target will no longer have a giant list of -I includes
(the examples at the end of the list had includes for all previous
examples, upwards of 200 -I's on the command line).

    * Created a CMakeLists.txt in the upm/examples directory, moved
      common functionality to this level.
    * C/C++ examples now look to the filename for their dependency
      target name, ie; gas-mq2.cxx adds a dependency to the 'gas' target
    * Updated a handful of C/C++ example names to reflect this
    * Example CMake flow - glob the list of files, add targets for any
      special case examples, then att targets for all the rest

Signed-off-by: Noel Eck <noel.eck@intel.com>
2017-04-05 15:16:20 -07:00

21 lines
936 B
CMake

# Create an list of all C++ source files in this directory
file (GLOB example_src_list RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cxx")
# - Handle special cases here --------------------------------------------------
# Test humidity interface for 2 sensor libraries
add_example(humidity-sensor.cxx TARGETS si7005 bmp280)
# Test pressure interface for 2 sensor libraries
add_example(pressure-sensor.cxx TARGETS bmp280 bmpx8x)
# Test temperature interface for 3 sensor libraries
add_example(temperature-sensor.cxx TARGETS bmp280 bmpx8x si7005)
# Test light interface for 2 sensor libraries
add_example(light-sensor.cxx TARGETS si1132 max44009)
# Test light controller interface for 3 sensor libraries
add_example(light-controller.cxx TARGETS lp8860 ds1808lc hlg150h)
# - Create an executable for all other src files in this directory -------------
foreach (_example_src ${example_src_list})
add_example(${_example_src})
endforeach ()