1
General / Integrate SFML as a git submodule
« on: October 09, 2019, 07:34:30 pm »
Hi,
I'd like to add SFML as a git submodule to an existing CMake project. Let's take this CMakeLists.txt as the starting point:
To add SFML as a submodule in the directory ./libs/sfml/, I do:
And then I adjust my CMakeLists.txt to:
It works, but is this the proper way to integrate SFML as a git submodule (statically linked)? I'm not sure if it's bad practice or if it's the way to go as I bypass the existing SFMLConfig.cmake script / the find_package(SFML ...) macro.
I'd like to add SFML as a git submodule to an existing CMake project. Let's take this CMakeLists.txt as the starting point:
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
project("Test")
set(SOURCE_FILES
src/main.cpp
)
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
project("Test")
set(SOURCE_FILES
src/main.cpp
)
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
To add SFML as a submodule in the directory ./libs/sfml/, I do:
git submodule add https://github.com/SFML/SFML.git libs/sfml
And then I adjust my CMakeLists.txt to:
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
project("Test")
set(SOURCE_FILES
src/main.cpp
)
set(BUILD_SHARED_LIBS FALSE)
add_subdirectory(libs/sfml)
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
target_link_libraries(${PROJECT_NAME} sfml-graphics)
target_link_libraries(${PROJECT_NAME} sfml-audio)
project("Test")
set(SOURCE_FILES
src/main.cpp
)
set(BUILD_SHARED_LIBS FALSE)
add_subdirectory(libs/sfml)
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
target_link_libraries(${PROJECT_NAME} sfml-graphics)
target_link_libraries(${PROJECT_NAME} sfml-audio)
It works, but is this the proper way to integrate SFML as a git submodule (statically linked)? I'm not sure if it's bad practice or if it's the way to go as I bypass the existing SFMLConfig.cmake script / the find_package(SFML ...) macro.