CMake: Don't modify global CFlags when enabling/disabling OpenJpeg
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 16 Sep 2015 14:08:26 +0000 (19:08 +0500)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 16 Sep 2015 14:10:41 +0000 (19:10 +0500)
CMakeLists.txt
extern/libopenjpeg/CMakeLists.txt
source/blender/imbuf/CMakeLists.txt

index 5b68ef1c26af0512709a6bba26f366bf1dfe98de..01116eec429b5a4d0b8632015d5d880e584de2fc 100644 (file)
@@ -2320,9 +2320,10 @@ endif()
 if(WITH_IMAGE_OPENJPEG)
        if(WITH_SYSTEM_OPENJPEG)
                # dealt with above
+               set(OPENJPEG_DEFINES "")
        else()
                set(OPENJPEG_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/extern/libopenjpeg")
-               add_definitions(-DOPJ_STATIC)
+               set(OPENJPEG_DEFINES "-DOPJ_STATIC")
        endif()
 endif()
 
index c602ddcabb9a8281c03ccf45ed87f6d936778d53..82eeb01b4d4c988776344151fca8dcb900342cc0 100644 (file)
@@ -31,10 +31,13 @@ set(INC_SYS
 
 )
 
+# TODO(sergey): Handle this via OPENJPEG_DEFINES
 if(WIN32)
        add_definitions(-DOPJ_STATIC)
 endif()
 
+add_definitions(${OPENJPEG_DEFINES})
+
 set(SRC
        bio.c
        cio.c
index bdd8230a6ffa65282df7f3f3e0d3cea896eca999..295a48dc24565316b6497f44038e1678eaa630da 100644 (file)
@@ -120,7 +120,7 @@ if(WITH_IMAGE_OPENJPEG)
                intern/jp2.c
        )
 
-       add_definitions(-DWITH_OPENJPEG)
+       add_definitions(-DWITH_OPENJPEG ${OPENJPEG_DEFINES})
 endif()
 
 if(WITH_IMAGE_REDCODE)