<div dir="ltr">How did you compile SDL?<br><br>Most generally, you would do:<br><br>find_path(SDL2_INCLUDE_DIR SDL.h PATH_SUFFIXES SDL2)<br># I have no idea against which libraries you have to link, so you might need more than this<br>

find_library(SDL2_LIBRARY SDL)<br><br>if(NOT SDL2_INCLUDE_DIR OR NOT SDL2_LIBRARY)<br>  message(SEND_ERROR &quot;Failed to find SDL2&quot;)<br>endif()<br>include_directories(${SDL2_INCLUDE_DIR})<br>set(SDL2_LIBRARIES ${SDL2_LIBRARY}) # and possibly others<br>

<br><br>add_executable(sdl_test sdl_test.cpp)<br>target_link_libraries(sdl_test ${SDL_LIBRARIES})<br><br><br>Then, when you invoke CMake, you use the -DCMAKE_PREFIX_PATH=/path/to/SDL/build flag to inform CMake about where to search for headers and libraries.<br>

</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Feb 4, 2013 at 3:14 PM, Ansis Māliņš <span dir="ltr">&lt;<a href="mailto:ansis.malins@gmail.com" target="_blank">ansis.malins@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">It looks like I&#39;m still asking the wrong questions.<br><div><br></div><div>As a last resort, here&#39;s my specific problem: I want to compile and run a hello world SDL2 application on Windows, Linux, and OS X - purely as an exercise in CMake. How would YOU do this?</div>



<div><br></div><div>SDL2 only exists in source form in their repository.<br></div><div><br></div><div>This is my main.cpp:</div><div><div><font face="courier new, monospace">#include &lt;SDL.h&gt;</font></div>

<div><font face="courier new, monospace">int main(int argc, char** argv)</font></div><div><font face="courier new, monospace">{</font></div><div><font face="courier new, monospace"><span style="white-space:pre-wrap">        </span>if (SDL_Init(SDL_INIT_VIDEO) &lt; 0) printf(&quot;FAILURE\n&quot;);</font></div>



<div><font face="courier new, monospace"><span style="white-space:pre-wrap">        </span>else printf(&quot;SUCCESS\n&quot;);</font></div><div><font face="courier new, monospace"><span style="white-space:pre-wrap">        </span>SDL_Quit();</font></div>



<div><font face="courier new, monospace"><span style="white-space:pre-wrap">        </span>return 0;</font></div><div><font face="courier new, monospace">}</font></div></div></div>
<br>--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br></blockquote></div><br></div>