Sign in to follow this  
Stormtrooper

Linking libraries through CMake?

Recommended Posts

Stormtrooper    100
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this