mirror of
https://github.com/recp/cglm.git
synced 2025-12-24 20:34:58 +00:00
Merge pull request #183 from legends2k/master
Add CMake interface library target
This commit is contained in:
@@ -93,6 +93,11 @@ target_include_directories(${PROJECT_NAME}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# Target for header-only usage
|
||||
add_library(${PROJECT_NAME}_headers INTERFACE)
|
||||
target_include_directories(${PROJECT_NAME}_headers INTERFACE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
|
||||
# Test Configuration
|
||||
if(CGLM_USE_TEST)
|
||||
include(CTest)
|
||||
|
||||
18
README.md
18
README.md
@@ -168,6 +168,24 @@ option(CGLM_USE_C99 "" OFF) # C11
|
||||
option(CGLM_USE_TEST "Enable Tests" OFF) # for make check - make test
|
||||
```
|
||||
|
||||
#### Use as header-only library with your CMake project
|
||||
|
||||
This requires no building or installation of cglm.
|
||||
|
||||
* Example:
|
||||
|
||||
``` cmake
|
||||
cmake_minimum_required(VERSION 3.8.2)
|
||||
|
||||
project(<Your Project Name>)
|
||||
|
||||
add_executable(${PROJECT_NAME} src/main.c)
|
||||
target_link_libraries(${LIBRARY_NAME} PRIVATE
|
||||
cglm_headers)
|
||||
|
||||
add_subdirectory(external/cglm/ EXCLUDE_FROM_ALL)
|
||||
```
|
||||
|
||||
#### Use with your CMake project
|
||||
* Example:
|
||||
```cmake
|
||||
|
||||
@@ -32,6 +32,22 @@ If you don't want to install **cglm** to your system's folder you can get static
|
||||
option(CGLM_USE_C99 "" OFF) # C11
|
||||
option(CGLM_USE_TEST "Enable Tests" OFF) # for make check - make test
|
||||
|
||||
**Use as header-only library with your CMake project example**
|
||||
This requires no building or installation of cglm.
|
||||
|
||||
.. code-block:: CMake
|
||||
:linenos:
|
||||
|
||||
cmake_minimum_required(VERSION 3.8.2)
|
||||
|
||||
project(<Your Project Name>)
|
||||
|
||||
add_executable(${PROJECT_NAME} src/main.c)
|
||||
target_link_libraries(${LIBRARY_NAME} PRIVATE
|
||||
cglm_headers)
|
||||
|
||||
add_subdirectory(external/cglm/ EXCLUDE_FROM_ALL)
|
||||
|
||||
**Use with your CMake project example**
|
||||
|
||||
.. code-block:: CMake
|
||||
|
||||
Reference in New Issue
Block a user