Jump to content
  • Advertisement
Sign in to follow this  
Stormtrooper

Linking libraries through CMake?

This topic is 3657 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

EDIT: It turns out it's because CMake can't find SDL. Where do I put SDL so CMake can find it? I'm trying to configure my project using cmake to generate Visual Studio 2008 project file to compile my project on Windows. The only problem is its not automatically linking SDL for me. I have to manually go in and add SDL.lib and SDLmain.lib to the project. How can I fix this?
FIND_PACKAGE(SDL REQUIRED)

SET(FLAGS "-DPACKAGE_VERSI=\\\"${VERSION}\\\"")
SET(FLAGS "${FLAGS} -DOSS_DATADIR=\\\"${PKG_DATADIR}/\\\"")

INCLUDE_DIRECTORIES(
	${URRENT_SOURCE_DIR}
	${SDL_INCLIDE_DIR}
	)
	
SET(SRCS
    utils/rectangle.cpp
    utils/point.cpp
	main.cpp
	)

TARGET_LINK_LIBRARIES(OpenSubSpace
	${SDL_LIBRARY}
	)
    
ADD_EXECUTABLE(OpenSubSpace ${SRCS})

Share this post


Link to post
Share on other sites
Advertisement
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!