mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2026-01-30 11:44:27 +01:00
Update CMakeLists.txt
Moved the add library method into sub dir. Also made this CMakeLists.txt script compatible for versions os CMake starting from 3.x and up.
This commit is contained in:
@@ -8,34 +8,15 @@
|
|||||||
# License: MIT #
|
# License: MIT #
|
||||||
# #
|
# #
|
||||||
###################################################################################
|
###################################################################################
|
||||||
cmake_minimum_required(VERSION 3.13.2.0 FATAL_ERROR)
|
cmake_minimum_required(VERSION 3 FATAL_ERROR)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# CMake: Declare project
|
|
||||||
#
|
|
||||||
project(unity LANGUAGES C DESCRIPTION "C Unit testing framework.")
|
project(unity LANGUAGES C DESCRIPTION "C Unit testing framework.")
|
||||||
|
|
||||||
|
|
||||||
|
add_subdirectory("src")
|
||||||
#
|
|
||||||
# CMake: Creation of library
|
|
||||||
#
|
|
||||||
add_library("unity" STATIC)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# CMake: Adding source to target
|
|
||||||
#
|
|
||||||
target_sources("unity" PRIVATE "src/unity.c")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# CMake: Including directories to target
|
|
||||||
#
|
|
||||||
target_include_directories("unity"
|
target_include_directories("unity"
|
||||||
PUBLIC
|
PUBLIC
|
||||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>"
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>"
|
||||||
@@ -44,18 +25,8 @@ target_include_directories("unity"
|
|||||||
PRIVATE "src"
|
PRIVATE "src"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# CMake: Give target an alias
|
|
||||||
#
|
|
||||||
add_library("unity::framework" ALIAS "unity")
|
add_library("unity::framework" ALIAS "unity")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# CMake: export project
|
|
||||||
#
|
|
||||||
install(TARGETS "unity" EXPORT "unityConfig"
|
install(TARGETS "unity" EXPORT "unityConfig"
|
||||||
ARCHIVE DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_INSTALL_LIBDIR}"
|
ARCHIVE DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_INSTALL_LIBDIR}"
|
||||||
LIBRARY DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_INSTALL_LIBDIR}"
|
LIBRARY DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_INSTALL_LIBDIR}"
|
||||||
|
|||||||
Reference in New Issue
Block a user