Jump to content
  • Advertisement
Sign in to follow this  
Fbhywn

Problem with cmake and SDL2

This topic is 1568 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello,

 

I have a problem with cmake and SDL2.

 

While linking the binary i get massive error with undefined references to SDL functions, but i link libSDL2.a to the binary.

 

The CMakeLists.txt is:

cmake_minimum_required(VERSION 2.8 FATAL_ERROR)

set(exe TBD)

set(CMAKE_CXX_COMPILER g++)
set(CMAKE_C_COMPILER gcc) 

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../include)
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../libs)

file(GLOB_RECURSE srcs Source/*.cpp)

add_executable(${exe} ${srcs})

set(CMAKE_EXE_LINKER_FLAGS -static) 

target_link_libraries(${exe} glew32 opengl32 glu32 SDL2 SDL2main)

If i remove the SDL2 and SDL2main in the linker libraries i get exactly the same errors.

 

I hope someone can help me.

 

Kind regards

Fbhywn

Share this post


Link to post
Share on other sites
Advertisement
First, posting the actual errors would be helpful.

Second, are you certain you are linking correctly like that? Usually with CMake I would expect to use FIND_PACKAGE with the appropriate parameters for the library and then use the variables set by finder (check their documentation).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!