Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Trying to get SFML to work as a git submodule  (Read 889 times)

0 Members and 1 Guest are viewing this topic.

ChaseRLewis73003

  • Newbie
  • *
  • Posts: 1
    • View Profile
Trying to get SFML to work as a git submodule
« on: July 24, 2022, 11:03:57 pm »
I'm wanting to build a small framework for some different 3d projects I want to do. I normally use glfw but I've heard good things about sfml and wanted to try it out. I'm not particularly good at CMake but I'm getting an odd error and not really sure why considering I don't even reference the library in another lib or exe yet.

The error I'm getting is LNK2001 'unresolved external symbol=' for exports.def and LNK1120 'unresolved externals' for sfml-window-d.lib.

My folder structure  is
src/
  KEngine/
      CMakeLists.txt
   Sandbox/
      CMakeLists.txt
   Submodules/
       sfml/
       CMakeLists.txt
   CMakeLists.txt

Root level Cmake lists
# CMakeList.txt : Top-level CMake project file, do global configuration
# and include sub-projects here.
#
cmake_minimum_required (VERSION 3.8)

project ("KEngine")
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)

# Include sub-projects.
add_subdirectory("Submodules")
add_subdirectory ("KEngine")
add_subdirectory("Sandbox")

src/submodules/CMakeLists.txt
# CMakeList.txt : Top-level CMake project file, do global configuration
# and include sub-projects here.
#
cmake_minimum_required (VERSION 3.8)

set(SFML_STATIC_LIBRARIES TRUE)
set(SFML_DIR "${CMAKE_SOURCE_DIR}/submodules/sfml")

# Include sub-projects.
add_subdirectory("glm")
add_subdirectory ("sfml")
add_subdirectory("spdlog")

# CMakeList.txt : CMake project for KEngine, include source and define
# project specific logic here.
#
cmake_minimum_required (VERSION 3.8)

# Add source to this project's executable.
add_library(KEngine SHARED "src/KEngine/Core/Window.h" "src/KEngine/Core/Window.cpp" "src/KEngine/Core/Ref.h" "src/KEngine/KEngine.h")
target_include_directories(KEngine PUBLIC "src")

if (CMAKE_VERSION VERSION_GREATER 3.12)
  set_property(TARGET KEngine PROPERTY CXX_STANDARD 20)
endif()

# TODO: Add tests and install targets if needed.