I've started to word on the build scripts for one of my SFML projects - but I keep running into dependency problems with the modules: OpenAL, Vorbis and Flac - here is the error I get for a given dependency:
CMake Error at /usr/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:165 (message):
Could NOT find FLAC (missing: FLAC_LIBRARY FLAC_INCLUDE_DIR)
Call Stack (most recent call first):
/usr/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:458 (_FPHSA_FAILURE_MESSAGE)
build/_deps/sfml-src/cmake/Modules/FindFLAC.cmake:16 (find_package_handle_standard_args)
build/_deps/sfml-src/cmake/Macros.cmake:279 (find_package)
build/_deps/sfml-src/src/SFML/Audio/CMakeLists.txt:71 (sfml_find_package)
To fix these I need to install the lib[module]-dev packages for each dependency with apt, but is there a way I could integrate the installation of such dependencies into the cmake build files. Here is a basic CMakeLists.txt file which should just compile a simple "hello world" SFML project, what could I add to resolve these problems? :
1 cmake_minimum_required(VERSION 3.18)
2 project(SfmlBasic VERSION 1.0)
3 include(FetchContent)
4 set(BUILD_SHARED_LIBS ON)
5 FetchContent_Declare(
6 SFML
7 GIT_REPOSITORY
https://github.com/SFML/SFML.git 8 GIT_TAG 2.5.1
9 )
10 FetchContent_MakeAvailable(SFML)
11 set(CMAKE_CXX_STANDARD 11)
12 set(CMAKE_CXX_STANDARD_REQUIRED true)
13 add_executable(
14 SfmlBasic
15 main.cpp
16 )
17 target_link_libraries(
18 SfmlBasic
19 sfml-graphics
20 )