mirror of
https://github.com/glfw/glfw.git
synced 2026-01-11 15:23:17 +01:00
Disable examples and tests when a subproject
This changes the default value of the GLFW_BUILD_EXAMPLES and GLFW_BUILD_TESTS CMake options to false when GLFW is being added as a subdirectory by another CMake project. If you want the previous behavior, force these options to true before adding the GLFW subdirectory: set(GLFW_BUILD_EXAMPLES ON CACHE BOOL "" FORCE) set(GLFW_BUILD_TESTS ON CACHE BOOL "" FORCE) add_subdirectory(path/to/glfw) Doing this is backward compatible with earlier versions of GLFW. The GLFW_BUILD_DOCS option is left enabled as it also requires Doxygen to have any effect, is quicker to build and is more likely to be useful when GLFW is a subproject.
This commit is contained in:
@@ -186,18 +186,8 @@ build_link_cmake_package.
|
||||
With a few changes to your `CMakeLists.txt` you can have the GLFW source tree
|
||||
built along with your application.
|
||||
|
||||
When including GLFW as part of your build, you probably don't want to build the
|
||||
GLFW tests, examples and documentation. To disable these, set the corresponding
|
||||
cache variables before adding the GLFW source tree.
|
||||
|
||||
@code
|
||||
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
|
||||
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
||||
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
||||
@endcode
|
||||
|
||||
Then add the root directory of the GLFW source tree to your project. This
|
||||
will add the `glfw` target and the necessary cache variables to your project.
|
||||
Add the root directory of the GLFW source tree to your project. This will add
|
||||
the `glfw` target and the necessary cache variables to your project.
|
||||
|
||||
@code{.cmake}
|
||||
add_subdirectory(path/to/glfw)
|
||||
|
||||
@@ -212,11 +212,13 @@ library or as a DLL / shared library / dynamic library.
|
||||
|
||||
@anchor GLFW_BUILD_EXAMPLES
|
||||
__GLFW_BUILD_EXAMPLES__ determines whether the GLFW examples are built
|
||||
along with the library.
|
||||
along with the library. This is enabled by default unless GLFW is being built
|
||||
as a sub-project.
|
||||
|
||||
@anchor GLFW_BUILD_TESTS
|
||||
__GLFW_BUILD_TESTS__ determines whether the GLFW test programs are
|
||||
built along with the library.
|
||||
built along with the library. This is enabled by default unless GLFW is being
|
||||
built as a sub-project.
|
||||
|
||||
@anchor GLFW_BUILD_DOCS
|
||||
__GLFW_BUILD_DOCS__ determines whether the GLFW documentation is built along
|
||||
|
||||
@@ -11,6 +11,20 @@
|
||||
|
||||
@subsection caveats_34 Caveats for version 3.4
|
||||
|
||||
@subsubsection standalone_34 Tests and examples are disabled when built as a sub-project
|
||||
|
||||
GLFW now does not build the tests and examples when it is added as
|
||||
a subdirectory of another CMake project. To enable these, set the @ref
|
||||
GLFW_BUILD_TESTS and @ref GLFW_BUILD_EXAMPLES cache variables before adding the
|
||||
GLFW subdirectory.
|
||||
|
||||
@code{.cmake}
|
||||
set(GLFW_BUILD_EXAMPLES ON CACHE BOOL "" FORCE)
|
||||
set(GLFW_BUILD_TESTS ON CACHE BOOL "" FORCE)
|
||||
add_subdirectory(path/to/glfw)
|
||||
@endcode
|
||||
|
||||
|
||||
@subsection deprecations_34 Deprecations in version 3.4
|
||||
|
||||
@subsection removals_34 Removals in 3.4
|
||||
|
||||
Reference in New Issue
Block a user