Skip to content

Commit 95742db

Browse files
committed
Added new find modules for various libraries
For assimp, fmt, glm and yaml-cpp.
1 parent 3aeb58b commit 95742db

File tree

4 files changed

+192
-0
lines changed

4 files changed

+192
-0
lines changed

Findassimp.cmake

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#[=======================================================================[.rst:
2+
Findassimp
3+
----------
4+
5+
A library to import and export various 3d-model-formats including
6+
scene-post-processing to generate missing render data.
7+
8+
http://assimp.org/
9+
10+
IMPORTED Targets
11+
^^^^^^^^^^^^^^^^
12+
13+
This module defines :prop_tgt:`IMPORTED` target ``assimp::assimp``, if
14+
yaml-cpp has been found.
15+
16+
17+
Result Variables
18+
^^^^^^^^^^^^^^^^
19+
20+
This module defines the following variables::
21+
22+
assimp_FOUND - "True" if yaml-cpp was found
23+
assimp_INCLUDE_DIRS - include directories for yaml-cpp
24+
assimp_LIBRARIES - link against this library to use yaml-cpp
25+
26+
The module will also define three cache variables::
27+
28+
assimp_INCLUDE_DIR - the yaml-cpp include directory
29+
assimp_LIBRARY - the path to the yaml-cpp library
30+
31+
#]=======================================================================]
32+
33+
find_path(assimp_INCLUDE_DIR NAMES assimp/types.h)
34+
find_library(assimp_LIBRARY NAMES assimp assimpd)
35+
36+
set(assimp_INCLUDE_DIRS ${assimp_INCLUDE_DIR})
37+
set(assimp_LIBRARIES ${assimp_LIBRARY})
38+
39+
find_package_handle_standard_args(assimp DEFAULT_MSG assimp_INCLUDE_DIR
40+
assimp_LIBRARY)
41+
42+
mark_as_advanced(assimp_INCLUDE_DIR assimp_LIBRARY)
43+
44+
if(assimp_FOUND AND NOT TARGET assimp::assimp)
45+
add_library(assimp::assimp UNKNOWN IMPORTED)
46+
set_target_properties(
47+
assimp::assimp
48+
PROPERTIES IMPORTED_LOCATION "${assimp_LIBRARIES}"
49+
INTERFACE_INCLUDE_DIRECTORIES "${assimp_INCLUDE_DIRS}")
50+
endif()

Findfmt.cmake

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#[=======================================================================[.rst:
2+
Findfmt
3+
----------
4+
5+
A library to import and export various 3d-model-formats including
6+
scene-post-processing to generate missing render data.
7+
8+
http://fmt.org/
9+
10+
IMPORTED Targets
11+
^^^^^^^^^^^^^^^^
12+
13+
This module defines :prop_tgt:`IMPORTED` target ``fmt::fmt``, if
14+
yaml-cpp has been found.
15+
16+
17+
Result Variables
18+
^^^^^^^^^^^^^^^^
19+
20+
This module defines the following variables::
21+
22+
fmt_FOUND - "True" if yaml-cpp was found
23+
fmt_INCLUDE_DIRS - include directories for yaml-cpp
24+
fmt_LIBRARIES - link against this library to use yaml-cpp
25+
26+
The module will also define three cache variables::
27+
28+
fmt_INCLUDE_DIR - the yaml-cpp include directory
29+
fmt_LIBRARY - the path to the yaml-cpp library
30+
31+
#]=======================================================================]
32+
33+
find_path(fmt_INCLUDE_DIR NAMES fmt/format.h)
34+
find_library(fmt_LIBRARY NAMES fmt)
35+
36+
set(fmt_INCLUDE_DIRS ${fmt_INCLUDE_DIR})
37+
set(fmt_LIBRARIES ${fmt_LIBRARY})
38+
39+
get_filename_component(fmt_INCLUDE_DIRS ${fmt_INCLUDE_DIRS} DIRECTORY)
40+
if(WIN32 OR APPLE)
41+
set(fmt_INCLUDE_DIRS ${fmt_INCLUDE_DIRS}/include)
42+
endif()
43+
44+
find_package_handle_standard_args(fmt DEFAULT_MSG fmt_INCLUDE_DIR fmt_LIBRARY)
45+
46+
mark_as_advanced(fmt_INCLUDE_DIR fmt_LIBRARY)
47+
48+
if(fmt_FOUND AND NOT TARGET fmt::fmt)
49+
add_library(fmt::fmt UNKNOWN IMPORTED)
50+
set_target_properties(
51+
fmt::fmt PROPERTIES IMPORTED_LOCATION "${fmt_LIBRARIES}"
52+
INTERFACE_INCLUDE_DIRECTORIES "${fmt_INCLUDE_DIRS}")
53+
endif()

Findglm.cmake

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#[=======================================================================[.rst:
2+
Findglm
3+
----------
4+
5+
OpenGL Mathematics (GLM) is a header only C++ mathematics library for
6+
graphics software based on the OpenGL Shading Language (GLSL) specifications.
7+
8+
https://glm.g-truc.net/
9+
10+
INTERFACE Targets
11+
^^^^^^^^^^^^^^^^^
12+
13+
This module defines the `INTERFACE` target ``glm``, if the glm header
14+
glm/glm.hpp has been found.
15+
16+
Result Variables
17+
^^^^^^^^^^^^^^^^
18+
19+
This module defines the following variables::
20+
21+
glm_FOUND - "True" if glm was found
22+
glm_INCLUDE_DIRS - include directories for glm
23+
24+
The module will also define these cache variables::
25+
26+
glm_INCLUDE_DIR - the glm include directory
27+
28+
#]=======================================================================]
29+
30+
find_path(glm_INCLUDE_DIR NAMES glm/glm.hpp)
31+
32+
set(glm_INCLUDE_DIRS ${Vulkan_INCLUDE_DIR})
33+
34+
find_package_handle_standard_args(glm DEFAULT_MSG glm_INCLUDE_DIR)
35+
36+
mark_as_advanced(glm_INCLUDE_DIR)
37+
if(glm_FOUND AND NOT TARGET glm)
38+
add_library(glm INTERFACE)
39+
target_include_directories(glm INTERFACE ${glm_INCLUDE_DIRS})
40+
endif()

Findyamlcpp.cmake

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#[=======================================================================[.rst:
2+
Findyamlcpp
3+
----------
4+
5+
yaml-cpp is a YAML parser and emitter in C++ matching the YAML 1.2 spec.
6+
7+
https://github.com/jbeder/yaml-cpp
8+
9+
IMPORTED Targets
10+
^^^^^^^^^^^^^^^^
11+
12+
This module defines :prop_tgt:`IMPORTED` target ``yamlcpp::yamlcpp``, if
13+
yaml-cpp has been found.
14+
15+
16+
Result Variables
17+
^^^^^^^^^^^^^^^^
18+
19+
This module defines the following variables::
20+
21+
yamlcpp_FOUND - "True" if yaml-cpp was found
22+
yamlcpp_INCLUDE_DIRS - include directories for yaml-cpp
23+
yamlcpp_LIBRARIES - link against this library to use yaml-cpp
24+
25+
The module will also define three cache variables::
26+
27+
yamlcpp_INCLUDE_DIR - the yaml-cpp include directory
28+
yamlcpp_LIBRARY - the path to the yaml-cpp library
29+
30+
#]=======================================================================]
31+
32+
find_path(yamlcpp_INCLUDE_DIR NAMES yaml-cpp/yaml.h)
33+
find_library(yamlcpp_LIBRARY NAMES yaml-cpp yaml-cppd)
34+
35+
set(yamlcpp_INCLUDE_DIRS ${yamlcpp_INCLUDE_DIR})
36+
set(yamlcpp_LIBRARIES ${yamlcpp_LIBRARY})
37+
38+
find_package_handle_standard_args(yamlcpp DEFAULT_MSG yamlcpp_INCLUDE_DIR
39+
yamlcpp_LIBRARY)
40+
41+
mark_as_advanced(yamlcpp_INCLUDE_DIR yamlcpp_LIBRARY)
42+
43+
if(yamlcpp_FOUND AND NOT TARGET yamlcpp::yamlcpp)
44+
add_library(yamlcpp::yamlcpp UNKNOWN IMPORTED)
45+
set_target_properties(
46+
yamlcpp::yamlcpp
47+
PROPERTIES IMPORTED_LOCATION "${yamlcpp_LIBRARIES}"
48+
INTERFACE_INCLUDE_DIRECTORIES "${yamlcpp_INCLUDE_DIRS}")
49+
endif()

0 commit comments

Comments
 (0)