Page 1 of 1

7e3a0562eb64eb798bd8e32a9bf99041

PostPosted: 12 Nov 2014, 18:14
by PsyPeng
57049138d2d3fbe9fbc7dae6f52e68f3

Re: [Cmake][SDL2][Code::Blocks] Cannot find -lSDL2 or -lSDL2

PostPosted: 12 Nov 2014, 19:35
by oln
You seem to be setting both the "-lSDL2" in the compiler flags and telling cmake to link with SDL with target_link_libraries. You don't need both. target_link_libraries links the provided libraries, you don't need to add the linker flags manually.

You can also use the "find_package" command to locate libraries, which is the common way of using cmake, but you will need to look on the web for a FindSDL2.cmake module, as the one coming with cmake is not updated for SDL2.

I would recommend looking at other projects using cmake to see how they are set up, cmake can be a bit confusing to get used to.

Re: [Cmake][SDL2][Code::Blocks] Cannot find -lSDL2 or -lSDL2

PostPosted: 13 Nov 2014, 06:36
by acme_pjz
Hi,

You can look at my project https://code.google.com/p/puzzleboy which uses SDL2. In fact I also found FindSDL2.cmake on the Internet :)