CMakeLists.txt: move example subdir adds after add_subdirectory(src) is called

This will ensure that all src modules are scanned first before
examples (c++/java).

In certain cases when doing parallel builds with many cores (8), the
examples for MODBUS, BACNET, and OPENZWAVE would not be built, since
their dependant libraries had not yet been located (in the src/
dir(s) via pkg_check_modules()), by the time the examples were being
compiled.

Signed-off-by: Jon Trulson <jtrulson@ics.com>
This commit is contained in:
Jon Trulson 2016-07-06 16:49:55 -06:00
parent 9ab9e2c403
commit 743730550c

View File

@ -231,14 +231,6 @@ if (RPM)
include(CPack) include(CPack)
endif() endif()
if(BUILDEXAMPLES)
add_subdirectory (examples/c++)
endif()
if(BUILDJAVAEXAMPLES)
add_subdirectory (examples/java)
endif()
if (BUILDSWIGPYTHON OR BUILDTESTS) if (BUILDSWIGPYTHON OR BUILDTESTS)
if (BUILDPYTHON3) if (BUILDPYTHON3)
set (PYTHONBUILD_VERSION 3) set (PYTHONBUILD_VERSION 3)
@ -248,6 +240,14 @@ if (BUILDSWIGPYTHON OR BUILDTESTS)
endif () endif ()
add_subdirectory (src) add_subdirectory (src)
if(BUILDEXAMPLES)
add_subdirectory (examples/c++)
endif()
if(BUILDJAVAEXAMPLES)
add_subdirectory (examples/java)
endif()
if (BUILDTESTS) if (BUILDTESTS)
find_package (PythonInterp ${PYTHONBUILD_VERSION} REQUIRED) find_package (PythonInterp ${PYTHONBUILD_VERSION} REQUIRED)