Skip to content

Commit

Permalink
WIP: Update CMake scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
eXpl0it3r committed Sep 19, 2024
1 parent c6b8c3d commit 98b235d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
15 changes: 8 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required( VERSION 3.2 )
cmake_minimum_required( VERSION 3.7.2 )

set( SFGUI_MAJOR_VERSION 0 )
set( SFGUI_MINOR_VERSION 4 )
Expand All @@ -8,25 +8,24 @@ set( SFGUI_VERSION ${SFGUI_MAJOR_VERSION}.${SFGUI_MINOR_VERSION}.${SFGUI_REVISIO
project( SFGUI LANGUAGES CXX VERSION ${SFGUI_VERSION} )
set(TARGET SFGUI)

set( CMAKE_CXX_STANDARD 11 )
set( CMAKE_CXX_STANDARD_REQUIRED ON )
set( CMAKE_CXX_EXTENSIONS OFF )

### USER INPUT ###

option( SFGUI_BUILD_SHARED_LIBS "Build shared library." ON )
set( BUILD_SHARED_LIBS ${SFGUI_BUILD_SHARED_LIBS} )
option( SFGUI_BUILD_EXAMPLES "Build examples." ON)
option( SFGUI_BUILD_DOC "Generate API documentation." OFF)
option( SFGUI_INCLUDE_FONT "Include default font in library (DejaVuSans)." ON)
option( SFML_STATIC_LIBRARIES "Do you want to link SFML statically?" OFF)
option( SFGUI_BUILD_EXAMPLES "Build examples." ON )
option( SFGUI_BUILD_DOC "Generate API documentation." OFF )
option( SFGUI_INCLUDE_FONT "Include default font in library (DejaVuSans)." ON )
option( SFML_STATIC_LIBRARIES "Do you want to link SFML statically?" OFF )


# Find packages.
find_package( OpenGL REQUIRED )

if( NOT TARGET sfml-graphics )
find_package( SFML 2.5 REQUIRED COMPONENTS graphics window system )
find_package( SFML 2.6 REQUIRED COMPONENTS graphics window system )
endif()

set( INCLUDE_PATH "${PROJECT_SOURCE_DIR}/include/" )
Expand All @@ -47,6 +46,8 @@ add_library( ${TARGET} ${CPPS} ${INLS} ${HPPS} )
target_include_directories( ${TARGET} PRIVATE "${PROJECT_SOURCE_DIR}/extlibs/libELL/include" "${SOURCE_PATH}" )
target_include_directories( ${TARGET} PUBLIC $<BUILD_INTERFACE:${INCLUDE_PATH}> $<INSTALL_INTERFACE:include/> )

target_compile_features( ${TARGET} PUBLIC cxx_std_11 )

if( NOT SFGUI_BUILD_SHARED_LIBS )
target_compile_definitions( ${TARGET} PUBLIC SFGUI_STATIC )
set_target_properties( ${TARGET} PROPERTIES DEBUG_POSTFIX -s-d )
Expand Down
2 changes: 1 addition & 1 deletion cmake/templates/config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Define Alias library @PROJECT_NAME@::@TARGET@

include( CMakeFindDependencyMacro )
find_dependency( SFML 2.5 COMPONENTS graphics window system)
find_dependency( SFML 2.6 COMPONENTS graphics window system)
find_dependency( OpenGL )

if( "${CMAKE_SYSTEM_NAME}" MATCHES "Linux" )
Expand Down
2 changes: 1 addition & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required( VERSION 3.2 )
cmake_minimum_required( VERSION 3.7.2 )

function( build_example SAMPLE_NAME SOURCES )
add_executable( ${SAMPLE_NAME} ${SOURCES} )
Expand Down

0 comments on commit 98b235d

Please sign in to comment.