diff --git a/CMakeLists.txt b/CMakeLists.txt index 78c5edfe..ea5eb339 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,6 +38,10 @@ cmake_dependent_option(BGFX_BUILD_TOOLS_GEOMETRY "Build bgfx geometry tools." ON cmake_dependent_option(BGFX_BUILD_TOOLS_TEXTURE "Build bgfx texture tools." ON BGFX_BUILD_TOOLS OFF) set(BGFX_TOOLS_PREFIX "" CACHE STRING "Prefix name to add to name of tools (to avoid clashes)") option(BGFX_BUILD_EXAMPLES "Build bgfx examples." ON) +cmake_dependent_option( + BGFX_BUILD_EXAMPLE_COMMON "Build bgfx example-common project." OFF "NOT BGFX_BUILD_EXAMPLES;NOT BGFX_BUILD_TOOLS" + ON +) option(BGFX_BUILD_TESTS "Build bgfx tests." OFF) option(BGFX_INSTALL "Create installation target." ON) cmake_dependent_option( diff --git a/cmake/bgfx/examples.cmake b/cmake/bgfx/examples.cmake index fcb61856..0c66fa2f 100755 --- a/cmake/bgfx/examples.cmake +++ b/cmake/bgfx/examples.cmake @@ -263,17 +263,19 @@ if(BGFX_CUSTOM_TARGETS) endif() # Add common library for examples -add_example( - common - COMMON - DIRECTORIES - ${BGFX_DIR}/examples/common/debugdraw - ${BGFX_DIR}/examples/common/entry - ${BGFX_DIR}/examples/common/font - ${BGFX_DIR}/examples/common/imgui - ${BGFX_DIR}/examples/common/nanovg - ${BGFX_DIR}/examples/common/ps -) +if(BGFX_BUILD_EXAMPLE_COMMON) + add_example( + common + COMMON + DIRECTORIES + ${BGFX_DIR}/examples/common/debugdraw + ${BGFX_DIR}/examples/common/entry + ${BGFX_DIR}/examples/common/font + ${BGFX_DIR}/examples/common/imgui + ${BGFX_DIR}/examples/common/nanovg + ${BGFX_DIR}/examples/common/ps + ) +endif() # Only add examples if set, otherwise we still need exmaples common for tools if(BGFX_BUILD_EXAMPLES)