summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/CMakeLists.txt13
1 files changed, 9 insertions, 4 deletions
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index ac3c612..120a8f3 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -8,10 +8,7 @@ if (PNG_FOUND)
LIST(APPEND TEST_FILES arc crop tgaread)
if (JPEG_FOUND)
- LIST(APPEND TESTS_FILES copyrotated flip nnquantnnquant)
- if (UNIX)
- target_link_libraries(copyrotated m)
- endif (UNIX)
+ LIST(APPEND TESTS_FILES copyrotated flip nnquant)
endif (JPEG_FOUND)
endif (PNG_FOUND)
@@ -34,6 +31,14 @@ FOREACH(test_name ${TESTS_FILES})
target_link_libraries (${test_name} ${GD_LINK_LIB})
ENDFOREACH(test_name)
+# Add libraries *after* we've called add_executable on all the tests.
+
+if (PNG_FOUND AND JPEG_FOUND)
+ if (UNIX)
+ target_link_libraries(copyrotated m)
+ endif (UNIX)
+endif(PNG_FOUND AND JPEG_FOUND)
+
if (WIN32 AND NOT MINGW AND NOT MSYS)
add_executable(windows WIN32 "windows.c")
target_link_libraries (windows ${GD_LINK_LIB})