diff --git a/CMakeLists.txt b/CMakeLists.txt index 845ddf0..9ccb9b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -181,9 +181,7 @@ foreach(flag ${test_flags}) endif (${test_c_flag}) endforeach(flag ${test_flags}) -if(MSVC) - set(CMAKE_DEBUG_POSTFIX "d") -endif() +set(CMAKE_DEBUG_POSTFIX "d") option(ld-version-script "Enable linker version script" ON) # Check if LD supports linker scripts. @@ -601,12 +599,15 @@ check_include_file(OpenGL/gl.h HAVE_OPENGL_GL_H) check_include_file(OpenGL/glu.h HAVE_OPENGL_GLU_H) # Win32 IO -set(win32_io FALSE) -if(WIN32) - set(win32_io TRUE) +set(USE_WIN32_FILEIO FALSE CACHE BOOL "") +if(MSVC) + if (NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") #on UWP we use the unix I/O api + set(USE_WIN32_FILEIO TRUE CACHE BOOL "" FORCE) + add_definitions(-DUSE_WIN32_FILEIO) + endif() + add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS /wd4996) endif() -set(USE_WIN32_FILEIO ${win32_io}) # Orthogonal features @@ -708,16 +709,28 @@ endif() #report_values(TIFF_INCLUDES TIFF_LIBRARY_DEPS) +option(BUILD_TOOLS "Build tool executables" ON) +option(BUILD_DOCS "Build docs" ON) +option(BUILD_CONTRIB "Build contributed executables" ON) +option(BUILD_TESTS "Build tests" ON) + # Process subdirectories add_subdirectory(port) add_subdirectory(libtiff) -add_subdirectory(tools) -add_subdirectory(test) -add_subdirectory(contrib) -add_subdirectory(build) -add_subdirectory(man) -add_subdirectory(html) - +if(BUILD_TOOLS) + add_subdirectory(tools) +endif() +if(BUILD_TESTS) + add_subdirectory(test) +endif() +if(BUILD_CONTRIB) + add_subdirectory(contrib) +endif() +if(BUILD_DOCS) + add_subdirectory(build) + add_subdirectory(man) + add_subdirectory(html) +endif() #message(STATUS "EXTRA_DIST: ${EXTRA_DIST}") message(STATUS "") diff --git a/libtiff/CMakeLists.txt b/libtiff/CMakeLists.txt index 1cf1b75..4ee29f6 100644 --- a/libtiff/CMakeLists.txt +++ b/libtiff/CMakeLists.txt @@ -104,11 +104,11 @@ set(tiffxx_HEADERS set(tiffxx_SOURCES tif_stream.cxx) -if(WIN32_IO) - extra_dist(tif_unix.c) +if(USE_WIN32_FILEIO) + extra_dist(tif_win32.c) list(APPEND tiff_SOURCES tif_win32.c) else() - extra_dist(tif_win32.c) + extra_dist(tif_unix.c) list(APPEND tiff_SOURCES tif_unix.c) endif() @@ -143,7 +143,7 @@ install(FILES ${tiff_HEADERS} ${nodist_tiff_HEADERS} DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}") if(CXX_SUPPORT) - add_library(tiffxx ${tiffxx_SOURCES} ${tiffxx_HEADERS}) + add_library(tiffxx STATIC ${tiffxx_SOURCES} ${tiffxx_HEADERS}) target_link_libraries(tiffxx tiff) set_target_properties(tiffxx PROPERTIES SOVERSION ${SO_COMPATVERSION}) if(NOT CYGWIN)