Commit Graph

97 Commits

Author SHA1 Message Date
Kitware Robot
1772622772 LICENSE: Replace references to Copyright.txt with LICENSE.rst
```
git grep -lz 'Copyright.txt or https://cmake.org/licensing ' |
  while IFS= read -r -d $'\0' f ; do
    sed -i '/Copyright.txt or https:\/\/cmake.org\/licensing / {
              s/Copyright.txt/LICENSE.rst/
            }' "$f" ; done
```
2025-03-03 10:43:35 -05:00
Nikita Nemkin
d138555959 Help: Use Title Case for all "Imported Targets" sections 2025-01-31 12:23:29 -05:00
Brad King
7afa58b15d Modules/Find*: Include FindPackageHandleStandardArgs normally
Since commit d74210a8bd (CMP0017: Remove support for OLD behavior,
2024-11-17) we can rely on CMP0017's NEW behavior unconditionally.
Calling `include(FindPackageHandleStandardArgs)` in a builtin module
will always get the builtin `FindPackageHandleStandardArgs`.
2025-01-30 08:53:12 -05:00
Peter Kokot
4e6a13f211 Use lower case style for commands
Where possible this syncs the CS for command names:

- check_c_source_compiles()
- check_cxx_compiler_flag()
- check_cxx_source_compiles()
- check_cxx_symbol_exists()
- check_include_file_cxx()
- check_include_file()
- check_include_files()
- check_library_exists()
- check_source_compiles()
- check_struct_has_member()
- check_symbol_exists()
- check_type_size()
- cmake_dependent_option()
- cmake_parse_arguments()
- feature_summary()
- file()
- find_package_handle_standard_args()
- if(), endif...
- install(FILES)
- list()
- message()
- pkg_check_modules()
- select_library_configurations()
- set_package_info()
- test_big_endian()
2025-01-28 13:51:46 -05:00
Jordan Williams
aebebf72df FindOpenGL: Add support for a separate GLU include directory
Add a OPENGL_GLU_INCLUDE_DIR cache variable for `GL/glu.h` and attach it
as an include directory to the `OpenGL::GLU` target.  Also add a
`OPENGL_INCLUDE_DIRS` result variable to list all include directories.
Account for the GLU header when deciding whether GLU is found.

Fixes: #25627
2024-02-05 14:06:06 -05:00
Randolph M. Fritz
1dbfe638da FindOpenGL: Document how to use macOS X11 OpenGL
Dicourse-topic: https://discourse.cmake.org/t/9466
2023-12-11 10:28:59 -05:00
Randolph M. Fritz
a13f62427b FindOpenGL: Clarify cache entry doc strings on macOS 2023-12-11 10:20:59 -05:00
Brad King
6b01a27f90 macOS: Simplify imported framework locations in find modules
Take advantage of commit d605f728f7 (macOS: Allow IMPORTED_LOCATION to
be a framework folder, 2023-06-16) to remove special-case framework
logic from find modules.

This changes link lines from `/path/to/Foo.framework/Foo[.tbd]` to
`-framework Foo`.  With the latter, the linker will automatically choose
the `.tbd` if it exists.

Issue: #24946
2023-08-25 11:05:18 -04:00
Brad King
04b0d5c862 codespell: Fix typos 2023-05-22 16:51:15 -04:00
Jaswant Panchumarti
beb0a56c86
FindOpenGL: support finding GLES2 and GLES3
This also makes the EGL component not GLVND-specific, so documentation
and tests are updated accordingly.
2023-03-10 13:24:27 -05:00
Colton G. Rushton
3a3ecef473 FindOpenGL: Fix confusing output with CMP0072 and OpenGL preference
If the legacy `GL` library is found, report that instead of GLVND's
`OpenGL` in the "found" message.
2022-08-30 13:59:48 -04:00
Ben Boeckel
fb4b2ed0d3 FindOpenGL: handle GLX without GLVND
On Ubuntu, installing `libgl-dev` provides `libGL` and `libGLX`, but no
`libOpenGL`. Avoid defining GLVND targets without the `OpenGL::OpenGL`
target.
2021-02-26 15:36:55 -05:00
Nikita Nemkin
8fea95319b Help: Add .. versionadded directives to module docs
Issue: #19715
2020-12-02 21:00:30 +05:00
Brad King
69d26f1502 Merge topic 'FPHSA-name-mismatches-chained-via-include'
98844ec9db FPHSA: detect inclusion between find modules

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Logan Barnes <barneslt63@gmail.com>
Merge-request: !5107
2020-08-10 11:25:10 -04:00
Ben Boeckel
98844ec9db FPHSA: detect inclusion between find modules
Various find modules include each other to delegate finding some subset
or variant of the package. Ideally, these would use `find_dependency` or
some other actual `find_package` mechanism, but that is a larger change.
Instead, just detect inclusion and suppress FPHSA name mismatch
warnings.

Fixes: #21060
2020-08-07 09:41:38 -04:00
Lemures Lemniscati
af666acdf4 FindOpenGL: Drop Cygwin-specific behavior and use POSIX code path
Based on downstream patch from Cygwin package for CMake by Marco Atzeri:

* 64864eb8f0/cmake/3.17.3-opengl.patch
2020-08-06 12:36:55 -04:00
Ben Boeckel
7e2ae4e96d FindOpenGL: only mark declared cache variables as advanced 2020-01-20 15:49:29 -05:00
Kyle Edwards
c3ef567951 Merge topic 'update-documentation'
cb811d11ce Help: Improve description of modules

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3222
2019-04-24 10:23:39 -04:00
Bartosz Kosiorek
cb811d11ce Help: Improve description of modules 2019-04-23 10:39:34 +02:00
Ben Boeckel
844050adaf FindOpenGL: look for GLVND libraries with a libglvnd suffix
On CentOS 6.10, the libglvnd package from EPEL installs its libraries
under a libglvnd subdirectory.
2019-04-17 10:16:46 -04:00
Kyle Edwards
0d988f98e5 cmake_policy: Add undocumented GET_WARNING command
This command is intended for modules that issue policy warnings so
they can get the warning string from CMake in a uniform manner,
rather than duplicating the string. Several modules been updated
to include an example of the usage of this new command.
2018-10-10 10:56:00 -04:00
Kyle Edwards
f9f96598df Help: Convert FindOpenGL documentation to block comment 2018-10-10 10:56:00 -04:00
Ben Boeckel
c2aec68333 FindOpenGL: remove duplicate OpenGL::GL reference 2018-01-18 11:10:13 -05:00
Brad King
b67762ff3c Merge topic 'hardcoded-path-removal'
a62d50ec Modules: Replace coded PATHS with PATH_SUFFIXES
fd56d6a8 FindMPEG,2: Update to current libmpeg2 behavior
5f382cd8 FindPike: Update names and paths
6720807d FindAVIFile: Replace PATHS with updated suffixes
f88ef9a9 Modules: Remove paths set as global Unix prefixes

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1502
2017-11-27 08:53:04 -05:00
Christian Pfeiffer
f88ef9a9b8 Modules: Remove paths set as global Unix prefixes
This commit removes hardcoded paths that are already given in the
platform files or in `UnixPath` on a global level.
2017-11-20 16:21:49 +01:00
Brad King
2ea17412a9 FindOpenGL: Add policy CMP0072 to prefer GLVND for legacy GL
Fixes: #17449
2017-11-17 07:17:28 -05:00
Brad King
ff3c11eeac FindOpenGL: Add option to prefer GLVND for legacy GL
Since commit v3.10.0-rc5~3^2 (FindOpenGL: Default to non-GLVND libraries
for legacy GL, 2017-11-08) users may set `OPENGL_gl_LIBRARY` to empty to
use GLVND components for the legacy GL interfaces.  This is useful only
when one knows in advance that the GLVND components will be found.

Add a `OpenGL_GL_PREFERENCE` variable to specify a preference for legacy
GL or GLVND.  The latter can suppress `OPENGL_gl_LIBRARY` only when the
needed GLVND components are found.  If no preference is explicitly
specified, choose a default based on whether GLVND components were
requested (because this indicates the project has been updated for
CMake 3.10).

Issue: #17437
Issue: #17449
2017-11-15 13:44:59 -05:00
Brad King
aadc38c7fd FindOpenGL: Re-order component library searches
Move the search for the legacy GL library to after the GLVND libraries.
For now we still always look for both.
2017-11-15 11:46:58 -05:00
Brad King
e6b209c870 FindOpenGL: Default to non-GLVND libraries for legacy GL
Projects using `OPENGL_LIBRARIES` or `OpenGL::GL` expect legacy GL.
Although GLVND OpenGL+GLX provides legacy GL interfaces, using those
library files may conflict with legacy GL library files used by
dependencies (or dependents) of such projects.  Therefore we should
not yet use OpenGL+GLX when a legacy GL library is available.

If `OPENGL_gl_LIBRARY` is set then use it as the legacy GL library.
If it is *not* set then fall back to using GLVND OpenGL+GLX to provide
legacy GL interfaces.  This will allow users to build projects using
GLVND even if they have not been ported.

Fixes: #17437
2017-11-09 09:47:12 -05:00
Brad King
f44fb2dd4c FindOpenGL: Clarify logic constructing OPENGL_LIBRARIES
Our comment says the logic matches that for OpenGL::GL.  Structure
the logic the same way to make this clearer.

Issue: #17437
2017-11-07 09:33:43 -05:00
Tom Fogal
e2e8a690cd FindOpenGL: Add support for GLVND on Linux
Find GLVND components if available.  Add `GLX` and `EGL` options for
COMPONENTS that allow requesting these libraries explicitly.  Introduce
new import targets for these windowing-system-specific libraries.

On a GLVND system, populate the legacy `OPENGL_LIBRARIES` variable and
the `OpenGL::GL` target using the `OpenGL` and `GLX` components.  On
non-GLVND systems, continue to use the legacy `GL` library and simply do
not provide the GLVND components.  Application code can choose to adapt
based on the availability of GLVND components as imported targets.
2017-09-25 09:22:29 -04:00
Daniel Pfeifer
9e24af0137 Use string(APPEND) in Modules
Automate with:

find Modules -type f -print0 | xargs -0 perl -i -0pe \
  's/set\(([a-zA-Z0-9_\$\{\}]+)(\s+)"\$\{\1\}([^"])/string(APPEND \1\2"\3/g'
2017-05-17 11:26:11 -06:00
Brad King
027ce359ff FindOpenGL: Provide imported targets for GL and GLU
Create OpenGL::GL and OpenGL::GLU imported targets using the locations
found.

This feature was originally added by commit v3.1.0-rc1~420^2~2
(FindOpenGL: Provide imported targets for GL and GLU, 2014-05-31) but
had to be reverted by commit v3.1.0-rc3~10^2 (FindOpenGL: Revert support
for imported targets, 2014-12-01) due to issue #15267.  Since then we
added support for `IMPORTED_LIBNAME` to interface libraries, so use it
to handle the case where we have only the library name without an
absolute path.

Inspired-by: Philipp Möller <bootsarehax@googlemail.com>
Closes: #15267
2016-12-02 15:11:49 -05:00
Rolf Eike Beer
745b56f58c Find*.cmake: drop the comments before including FPHSA
No need to explain this over and over again.  While at it, do some other
minor cleanups to whitespace and comments (i.e. delete them).
2016-11-28 16:40:13 -05:00
Brad King
86578eccf2 Simplify CMake per-source license notices
Per-source copyright/license notice headers that spell out copyright holder
names and years are hard to maintain and often out-of-date or plain wrong.
Precise contributor information is already maintained automatically by the
version control tool.  Ultimately it is the receiver of a file who is
responsible for determining its licensing status, and per-source notices are
merely a convenience.  Therefore it is simpler and more accurate for
each source to have a generic notice of the license name and references to
more detailed information on copyright holders and full license terms.

Our `Copyright.txt` file now contains a list of Contributors whose names
appeared source-level copyright notices.  It also references version control
history for more precise information.  Therefore we no longer need to spell
out the list of Contributors in each source file notice.

Replace CMake per-source copyright/license notice headers with a short
description of the license and links to `Copyright.txt` and online information
available from "https://cmake.org/licensing".  The online URL also handles
cases of modules being copied out of our source into other projects, so we
can drop our notices about replacing links with full license text.

Run the `Utilities/Scripts/filter-notices.bash` script to perform the majority
of the replacements mechanically.  Manually fix up shebang lines and trailing
newlines in a few files.  Manually update the notices in a few files that the
script does not handle.
2016-09-27 15:14:44 -04:00
David Gobbi
08580be2ad FindOpenGL: Don't add AGL to OPENGL_LIBRARIES on OS X.
CMake had been setting OPENGL_glu_LIBRARY to AGL.framework, even
though AGL is not GLU.  AGL is simply the GL component for the
deprecated Carbon framework.  GLU is provided by OpenGL.framework.

A side effect of the old behavior was that if AGL was not found
(it is absent from OS X SDK 10.10 or later), then OPENGL_GLU_FOUND
would be incorrectly set to "NO".
2015-12-14 09:46:32 -05:00
Brad King
cf63779f35 Merge topic 'FindOpenGL-revert-imported-targets'
02e34de2 FindOpenGL: Revert support for imported targets (#15267)
2014-12-03 10:01:42 -05:00
Brad King
02e34de2b6 FindOpenGL: Revert support for imported targets (#15267)
Revert the feature added by commit v3.1.0-rc1~420^2~2 (FindOpenGL:
Provide imported targets for GL and GLU, 2014-05-31).  Unfortunately it
does not work on Windows because the full path to each library file is
not actually known.  The IMPORTED_LOCATION of an imported target must be
a full path, but OPENGL_gl_LIBRARY is just 'opengl32' on Windows because
the actual library file is in some implicit link directory that we may
know know.

More infrastructure will be needed in CMake to allow a name-only
imported library.  Until that exists, we will not be able to provide
imported targets in FindOpenGL.
2014-12-01 16:01:09 -05:00
Brad King
d051cbda5d FindOpenGL: Drop explicit dependency on X11 (#15268)
In commit 079e8469ab (... OpenGL always needs X11 on Unix, 2002-09-05)
the FindOpenGL module was taught to search for X11 as a dependency of
the OpenGL library.  This was done without a detailed explanation, and
the dependency should not be explicitly needed because OpenGL headers
should not expose applications to X11 APIs directly.

Unfortunately the only way to know if anything legitimately depends on
this behavior (perhaps in static library cases) is to simply remove it
and wait for issues to be reported.  If so, then we can add some kind of
compatibility setting for this later.  Add a release note to draw
attention to this change.

Reported-by: Dainius "GreatEmerald" Masiliūnas <pastas4@gmail.com>
2014-12-01 11:05:29 -05:00
Brad King
94770baf30 FindOpenGL: Fix typo in documented target name
We provide "OpenGL::GL", not "OpenGL::OpenGL".

Reported-by: Daniel Pfeifer
2014-06-09 08:54:22 -04:00
Philipp Möller
b7804cb6ce FindOpenGL: Provide imported targets for GL and GLU
Create OpenGL::GL and OpenGL::GLU imported targets using the locations
found.
2014-06-05 14:29:45 -04:00
Philipp Möller
0496c4302e FindOpenGL: Organize and format module documentation 2014-06-05 09:58:40 -04:00
Kitware Robot
f051814ed0 Convert builtin help to reStructuredText source files
Run the convert-help.bash script to convert documentation:

 ./convert-help.bash "/path/to/CMake-build/bin"

Then remove it.
2013-10-15 14:12:03 -04:00
Rolf Eike Beer
5be35935dc FindOpenGL: require headers to be found on non-Windows platforms (#13746) 2013-04-17 12:59:52 +02:00
Rolf Eike Beer
b10a1713dc FindOpenGL: simplify OS selection code
This was using nested if's, now it uses elseif to flatten that. It also removes
one "if" from the general "else" branch that checks for Apple, as that has it's
own branch anyway and can't be true at this point.
2013-04-17 12:46:13 +02:00
Rolf Eike Beer
0380f36cd8 FindOpenGL: add Haiku paths
Also check the HP-UX specific paths only when on HP-UX.
2013-01-08 00:39:53 +01:00
Rolf Eike Beer
8ebf74b02f Find* (and some other): use ${CMAKE_CURRENT_LIST_DIR} in include()
This solves a lots of warnings, e.g. in the FindModulesExecuteAll test. If the
installed version on the system is rather old this may even lead to bugs, e.g.
https://bugs.gentoo.org/show_bug.cgi?id=436540
2012-11-04 05:55:37 +01:00
Kitware Robot
9db3116226 Remove CMake-language block-end command arguments
Ancient versions of CMake required else(), endif(), and similar block
termination commands to have arguments matching the command starting the
block.  This is no longer the preferred style.

Run the following shell code:

for c in else endif endforeach endfunction endmacro endwhile; do
    echo 's/\b'"$c"'\(\s*\)(.\+)/'"$c"'\1()/'
done >convert.sed &&
git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' |
egrep -z -v '^(Utilities/cm|Source/kwsys/)' |
egrep -z -v 'Tests/CMakeTests/While-Endwhile-' |
xargs -0 sed -i -f convert.sed &&
rm convert.sed
2012-08-13 14:19:16 -04:00
Kitware Robot
77543bde41 Convert CMake-language commands to lower case
Ancient CMake versions required upper-case commands.  Later command
names became case-insensitive.  Now the preferred style is lower-case.

Run the following shell code:

cmake --help-command-list |
grep -v "cmake version" |
while read c; do
    echo 's/\b'"$(echo $c | tr '[:lower:]' '[:upper:]')"'\(\s*\)(/'"$c"'\1(/g'
done >convert.sed &&
git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' |
egrep -z -v '^(Utilities/cm|Source/kwsys/)' |
xargs -0 sed -i -f convert.sed &&
rm convert.sed
2012-08-13 14:19:16 -04:00
Kitware Robot
7bbaa4283d Remove trailing whitespace from most CMake and C/C++ code
Our Git commit hooks disallow modification or addition of lines with
trailing whitespace.  Wipe out all remnants of trailing whitespace
everywhere except third-party code.

Run the following shell code:

git ls-files -z -- \
 bootstrap doxygen.config '*.readme' \
 '*.c' '*.cmake' '*.cpp' '*.cxx' \
 '*.el' '*.f' '*.f90' '*.h' '*.in' '*.in.l' '*.java' \
 '*.mm' '*.pike' '*.py' '*.txt' '*.vim' |
egrep -z -v '^(Utilities/cm|Source/(kwsys|CursesDialog/form)/)' |
egrep -z -v '^(Modules/CPack\..*\.in)' |
xargs -0 sed -i 's/ \+$//'
2012-08-13 14:18:39 -04:00