diff --git a/CMakeLists.txt b/CMakeLists.txt index c7640b8b..d1f30ecb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -382,25 +382,24 @@ elseif(UNIX) if(BUNDLED_JPEG) if(CROSS_COMPILE32) if(APPLE) - add_custom_command(OUTPUT ${CMAKE_CURRENT_LIST_DIR}/jpegturbo/.libs/libturbojpeg.a - COMMAND make clean || true - COMMAND ${CROSS_COMPILE32_FLAGS} ./configure --with-jpeg8 --build i686-apple-darwin && make - WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/jpegturbo - ) + SET(JPEG_TURBO_BUILD ${CROSS_COMPILE32_FLAGS} ./configure --with-jpeg8 --build i686-apple-darwin && make) else() - add_custom_command(OUTPUT ${CMAKE_CURRENT_LIST_DIR}/jpegturbo/.libs/libturbojpeg.a - COMMAND make clean || true - COMMAND ${CROSS_COMPILE32_FLAGS} ./configure --with-jpeg8 --build i686-pc-linux-gnu && make - WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/jpegturbo - ) + SET(JPEG_TURBO_BUILD ${CROSS_COMPILE32_FLAGS} ./configure --with-jpeg8 --build i686-pc-linux-gnu && make) endif() else(CROSS_COMPILE32) - add_custom_command(OUTPUT ${CMAKE_CURRENT_LIST_DIR}/jpegturbo/.libs/libturbojpeg.a - COMMAND make clean || true - COMMAND ${CROSS_COMPILE32_FLAGS} ./configure --with-jpeg8 && make - WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/jpegturbo - ) + if(APPLE) + SET(JPEG_TURBO_BUILD ${CROSS_COMPILE32_FLAGS} ./configure --with-jpeg8 --build x86_64-apple-darwin && make) + else() + SET(JPEG_TURBO_BUILD ${CROSS_COMPILE32_FLAGS} ./configure --with-jpeg8 && make) + endif() endif() + + add_custom_command(OUTPUT ${CMAKE_CURRENT_LIST_DIR}/jpegturbo/.libs/libturbojpeg.a + COMMAND make clean || true + COMMAND ${JPEG_TURBO_BUILD} + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/jpegturbo + ) + add_custom_target(bundled_jpeg DEPENDS ${CMAKE_CURRENT_LIST_DIR}/jpegturbo/.libs/libturbojpeg.a )