1 # ---------------------------------------------------------------------------- 2 # CMake file for libjpeg. See root CMakeLists.txt 3 # 4 # ---------------------------------------------------------------------------- 5 project(${JPEG_LIBRARY}) 6 7 ocv_include_directories(${CMAKE_CURRENT_SOURCE_DIR}) 8 9 file(GLOB lib_srcs *.c) 10 file(GLOB lib_hdrs *.h) 11 12 if(ANDROID OR IOS OR APPLE) 13 ocv_list_filterout(lib_srcs jmemansi.c) 14 else() 15 ocv_list_filterout(lib_srcs jmemnobs.c) 16 endif() 17 18 if(WINRT) 19 add_definitions(-DNO_GETENV) 20 get_directory_property( DirDefs COMPILE_DEFINITIONS ) 21 message(STATUS "Adding NO_GETENV to compiler definitions for WINRT:") 22 message(STATUS " COMPILE_DEFINITIONS = ${DirDefs}") 23 endif() 24 25 # ---------------------------------------------------------------------------------- 26 # Define the library target: 27 # ---------------------------------------------------------------------------------- 28 29 add_library(${JPEG_LIBRARY} STATIC ${lib_srcs} ${lib_hdrs}) 30 31 if(UNIX) 32 if(CMAKE_COMPILER_IS_GNUCXX OR CV_ICC) 33 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") 34 endif() 35 endif() 36 37 if(CMAKE_COMPILER_IS_GNUCXX) 38 set_source_files_properties(jcdctmgr.c PROPERTIES COMPILE_FLAGS "-O1") 39 endif() 40 41 ocv_warnings_disable(CMAKE_C_FLAGS -Wcast-align -Wshadow -Wunused) 42 ocv_warnings_disable(CMAKE_C_FLAGS -Wunused-parameter) # clang 43 ocv_warnings_disable(CMAKE_C_FLAGS /wd4013 /wd4244 /wd4267) # vs2005 44 45 set_target_properties(${JPEG_LIBRARY} 46 PROPERTIES OUTPUT_NAME ${JPEG_LIBRARY} 47 DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" 48 ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH} 49 ) 50 51 if(ENABLE_SOLUTION_FOLDERS) 52 set_target_properties(${JPEG_LIBRARY} PROPERTIES FOLDER "3rdparty") 53 endif() 54 55 if(NOT BUILD_SHARED_LIBS) 56 ocv_install_target(${JPEG_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev) 57 endif() 58