<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Cant load bitmap on CLion (Cmake)</title>
		<link>http://www.allegro.cc/forums/view/618800</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Fri, 24 Mar 2023 23:06:14 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I can run allegro 4 on Code::Blocks and load bitmaps without any issues like so:</p><p>#include &lt;allegro.h&gt;</p><p>int main() {<br />    allegro_init(); <br />    install_keyboard();</p><p>    set_color_depth(16); <br />    set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0); </p><p>    //load BMP<br />    BITMAP* image = load_bitmap(&quot;images/dvdlogo.bmp&quot;, NULL);<br />    if (!image) { //if not loaded, err out<br />        return 1;<br />    }</p><p>    blit(image, screen, 0, 0, 0, 0, image-&gt;w, image-&gt;h);<br />    readkey();<br />    destroy_bitmap(image);<br />    return 0;<br />}<br />END_OF_MAIN()</p><p>When I try to run it on CLion, the code executes but I can&#39;t figure out how to add a bitmap to my CMake.</p><p>Here&#39;s the current CMake:</p><p>cmake_minimum_required(VERSION 3.24)<br />project(allegro_test C)</p><p>set(CMAKE_C_STANDARD 99)</p><p>add_executable(allegro_test main.c)</p><ol><li><p>Lier le programme avec les bibliothèques Allegro
</p></li></ol><p>target_link_libraries(allegro_test -lalleg44)</p><p>set (R_DIR &quot;/images&quot;)<br />set(CMAKE_MFC_FLAG 1)<br />add_executable(main WIN32 main.c images)<br />set_target_properties(main PROPERTIES RESOURCE /images/dvdlogo.bmp)<br />target_include_directories(allegro_test PRIVATE ${IMAGE_DIR})</p><ol><li><p>Copier le fichier BMP dans le répertoire de build
</p></li></ol><p>configure_file(C:/Users/lasbo/CLionProjects/allegro_test/images/dvdlogo.bmp ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)</p><p>include_directories(${PROJECT_SOURCE_DIR} images)</p><p>Does anyone know any way to load bmps with Clion/CMake?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Lox Chatterbox)</author>
		<pubDate>Fri, 24 Mar 2023 02:09:17 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Your working directory is probably off. Try running your program from the directory expected by your program&#39;s bitmap loading code. CLion probably has a setting somewhere for working directory at run time.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Fri, 24 Mar 2023 23:06:14 +0000</pubDate>
	</item>
</rss>
