Skip to content

Commit

Permalink
cmake: Clean up CMake declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
RobLoach committed Jan 16, 2022
1 parent 97770c1 commit c6736d0
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 32 deletions.
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
[submodule "vendor/raylib"]
path = vendor/raylib
url = https://github.com/raysan5/raylib.git
ignore = dirty
[submodule "vendor/nuklear"]
path = vendor/nuklear
url = https://github.com/Immediate-Mode-UI/Nuklear.git
Expand Down
42 changes: 21 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.11)
project(raylib-nuklear
DESCRIPTION "raylib-nuklear: Nuklear immediate mode GUI for raylib."
project(raylib_nuklear
DESCRIPTION "raylib_nuklear: Nuklear immediate mode GUI for raylib."
HOMEPAGE_URL "https://github.com/robloach/raylib-nuklear"
VERSION 4.0.1
LANGUAGES C
Expand All @@ -9,27 +9,27 @@ project(raylib-nuklear
# raylib-nuklear
add_subdirectory(include)

# Options
if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
set(RAYLIB_NUKLEAR_IS_MAIN TRUE)
else()
set(RAYLIB_NUKLEAR_IS_MAIN FALSE)
endif()
option(RAYLIB_NUKLEAR_BUILD_EXAMPLES "Examples" ${RAYLIB_NUKLEAR_IS_MAIN})

# Examples
option(BUILD_RAYLIB_NUKLEAR_EXAMPLES "Build Examples" ON)
if (BUILD_RAYLIB_NUKLEAR_EXAMPLES)
# raylib
find_package(raylib QUIET)
if (NOT raylib_FOUND)
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(BUILD_GAMES OFF CACHE BOOL "" FORCE)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/vendor/raylib)
endif()
if (RAYLIB_NUKLEAR_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()

# Testing
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
include(CTest)
enable_testing()
if(BUILD_TESTING AND BUILD_RAYLIB_NUKLEAR_EXAMPLES)
set(CTEST_CUSTOM_TESTS_IGNORE
pkg-config--static
)
add_subdirectory(test)
# Testing
if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
include(CTest)
enable_testing()
if (BUILD_TESTING)
# set(CTEST_CUSTOM_TESTS_IGNORE
# pkg-config--static
# )
add_subdirectory(test)
endif()
endif()
endif()
25 changes: 22 additions & 3 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
# raylib
find_package(raylib QUIET)
if (NOT raylib_FOUND)
include(FetchContent)
FetchContent_Declare(
raylib
GIT_REPOSITORY https://github.com/raysan5/raylib.git
GIT_TAG 4.0.0
)
FetchContent_GetProperties(raylib)
if (NOT raylib_POPULATED) # Have we downloaded raylib yet?
set(FETCHCONTENT_QUIET NO)
FetchContent_Populate(raylib)
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(BUILD_GAMES OFF CACHE BOOL "" FORCE)
add_subdirectory(${raylib_SOURCE_DIR} ${raylib_BINARY_DIR})
endif()
endif()

# raylib-nuklear-example
add_executable(raylib-nuklear-example
raylib-nuklear-example.c
)
target_link_libraries(raylib-nuklear-example PUBLIC
raylib
raylib-nuklear
raylib_nuklear
)

# raylib-nuklear-demo
Expand All @@ -13,7 +32,7 @@ add_executable(raylib-nuklear-demo
)
target_link_libraries(raylib-nuklear-demo PUBLIC
raylib
raylib-nuklear
raylib_nuklear
)

# raylib-nuklear-font
Expand All @@ -22,7 +41,7 @@ add_executable(raylib-nuklear-font
)
target_link_libraries(raylib-nuklear-font PUBLIC
raylib
raylib-nuklear
raylib_nuklear
)

# Resources
Expand Down
4 changes: 2 additions & 2 deletions include/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# raylib-nuklear
add_library(raylib-nuklear INTERFACE)
target_include_directories(raylib-nuklear INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
add_library(raylib_nuklear INTERFACE)
target_include_directories(raylib_nuklear INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
install(FILES
raylib-nuklear.h
nuklear.h
Expand Down
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ add_executable(raylib-nuklear-test raylib-nuklear-test.c)
target_compile_options(raylib-nuklear-test PRIVATE -Wall -Wextra -Wconversion -Wsign-conversion)
target_link_libraries(raylib-nuklear-test PUBLIC
raylib
raylib-nuklear
raylib_nuklear
)

# Copy the resources
Expand Down
1 change: 0 additions & 1 deletion vendor/raylib
Submodule raylib deleted from 085196

0 comments on commit c6736d0

Please sign in to comment.