summaryrefslogtreecommitdiffhomepage
path: root/examples/CMakeLists.txt
diff options
context:
space:
mode:
authorPeter0x44 <[email protected]>2024-02-26 09:25:47 +0000
committerGitHub <[email protected]>2024-02-26 10:25:47 +0100
commitb86f78f6b179dc374458680f8b192558a1e4a3c6 (patch)
treec90bc41b4d2124d841cf80b2e160ad8b7973c2db /examples/CMakeLists.txt
parentc588a291e61586c5b74e230919b490aab18d8290 (diff)
downloadraylib-b86f78f6b179dc374458680f8b192558a1e4a3c6.tar.gz
raylib-b86f78f6b179dc374458680f8b192558a1e4a3c6.zip
Fix examples linking with CMake and -DPLATFORM=SDL (#3825)
Currently, every example fails linking likeso: [ 3%] Linking C executable audio_mixed_processor /usr/bin/ld: ../raylib/libraylib.a(raudio.c.o): undefined reference to symbol 'exp@@GLIBC_2.29' /usr/bin/ld: /usr/lib/libm.so.6: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status Apparently, linking libm explicitly is the solution.
Diffstat (limited to 'examples/CMakeLists.txt')
-rw-r--r--examples/CMakeLists.txt3
1 files changed, 3 insertions, 0 deletions
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 3bcdc19f..c5fa659e 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -131,6 +131,9 @@ foreach (example_source ${example_sources})
add_executable(${example_name} ${example_source})
target_link_libraries(${example_name} raylib)
+ if (NOT WIN32)
+ target_link_libraries(${example_name} m)
+ endif()
string(REGEX MATCH ".*/.*/" resources_dir ${example_source})
string(APPEND resources_dir "resources")