"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "CMakeLists.txt" between
cfitsio-3.49.tar.gz and cfitsio-4.0.0.tar.gz

About: CFITSIO is a library of C and Fortran subroutines for reading and writing data files in the FITS (Flexible Image Transport System) data format.

CMakeLists.txt  (cfitsio-3.49):CMakeLists.txt  (cfitsio-4.0.0)
#==============================================================================
# CFITSIO CMakeLists.txt # CFITSIO CMakeLists.txt
#==============================================================================
# Ensure that build directory is not the source directory:
IF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR
"Please create a separate directory for building CFITSIO."
)
ENDIF()
CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
# Suppress warning about WIN32 no longer being defined on Cygwin: # Suppress warning about WIN32 no longer being defined on Cygwin:
SET(CMAKE_LEGACY_CYGWIN_WIN32 0) SET(CMAKE_LEGACY_CYGWIN_WIN32 0)
PROJECT(CFITSIO) PROJECT(CFITSIO
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0) DESCRIPTION "Library of C and Fortran subroutines for reading and writing
data files in FITS data format."
LANGUAGES C CXX
)
# Define project version
SET(${PROJECT_NAME}_MAJOR_VERSION 4)
SET(${PROJECT_NAME}_MINOR_VERSION 0)
SET(${PROJECT_NAME}_MICRO_VERSION 0)
SET(${PROJECT_NAME}_VERSION ${${PROJECT_NAME}_MAJOR_VERSION}.${${PROJECT_NAME}_M
INOR_VERSION}.${${PROJECT_NAME}_MICRO_VERSION})
SET(LIB_NAME cfitsio)
# Allow @rpath token in target install name on Macs. # Allow @rpath token in target install name on Macs.
# See "cmake --help-policy CMP0042" for more information. # See "cmake --help-policy CMP0042" for more information.
IF(POLICY CMP0042) IF(POLICY CMP0042)
CMAKE_POLICY(SET CMP0042 NEW) CMAKE_POLICY(SET CMP0042 NEW)
ENDIF() ENDIF()
INCLUDE (${CMAKE_ROOT}/Modules/CheckLibraryExists.cmake) INCLUDE(CheckLibraryExists)
INCLUDE (${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake) INCLUDE(CheckFunctionExists)
INCLUDE(CheckSymbolExists)
INCLUDE(CheckCSourceCompiles)
#==============================================================================
# Build options:
#==============================================================================
# Allow the developer to select if Dynamic or Static libraries are built # Allow the developer to select if Dynamic or Static libraries are built
OPTION (BUILD_SHARED_LIBS "Build Shared Libraries" ON) OPTION(BUILD_SHARED_LIBS "Build Shared Libraries" ON)
OPTION (USE_PTHREADS "Thread-safe build (using pthreads)" OFF)
# Allow curl dependency to be disabled using "-DUseCurl=OFF": # Allow curl dependency to be disabled with "-DUSE_CURL=OFF":
OPTION(UseCurl "UseCurl" ON) OPTION(USE_CURL "USE_CURL" ON)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}") OPTION(USE_PTHREADS "Thread-safe build (using pthreads)" OFF)
set (LIB_DESTINATION "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}")
set (INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include/")
# Define project version OPTION(TESTS "Build test programs Testprog and cookbook" OFF)
SET(${PROJECT_NAME}_MAJOR_VERSION 3)
SET(${PROJECT_NAME}_MINOR_VERSION 49) OPTION(UTILS "Build FPack, Funpack, and Fitscopy executables" OFF)
SET(${PROJECT_NAME}_VERSION ${${PROJECT_NAME}_MAJOR_VERSION}.${${PROJECT_NAME}_M
INOR_VERSION}) OPTION(CFITSIO_USE_SSE2 "Enable use of instructions in the SSE2 extended instruc
SET(LIB_NAME cfitsio) tion set" OFF)
OPTION(CFITSIO_USE_SSSE3 "Enable use of instructions in the SSSE3 extended instr
uction set" OFF)
IF(NOT WIN32)
OPTION(CFITSIO_USE_BZIP2 "Enable bzip2 support" OFF)
ENDIF()
#==============================================================================
FIND_PACKAGE(ZLIB REQUIRED)
IF(BUILD_SHARED_LIBS)
SET (LIB_TYPE SHARED)
ELSE()
SET (LIB_TYPE STATIC)
ENDIF(BUILD_SHARED_LIBS)
IF(NOT MSVC)
# Find curl library, for HTTPS support:
IF(USE_CURL)
FIND_PACKAGE(CURL)
IF(CURL_FOUND)
ADD_DEFINITIONS(-DCFITSIO_HAVE_CURL)
ENDIF()
ENDIF()
ENDIF(NOT MSVC)
IF(USE_PTHREADS)
FIND_PACKAGE(Threads REQUIRED)
ADD_DEFINITIONS(-D_REENTRANT)
ENDIF(USE_PTHREADS)
IF(CFITSIO_USE_BZIP2)
FIND_PACKAGE(BZip2 REQUIRED)
ADD_DEFINITIONS(-DHAVE_BZIP2=1)
ENDIF(CFITSIO_USE_BZIP2)
# Math library (not available in MSVC or MINGW)
IF(MSVC OR MINGW)
SET(M_LIB "")
ELSE()
FIND_LIBRARY(M_LIB m)
ENDIF()
# Support for remote file drivers is not implemented for native Windows:
IF (NOT MSVC)
# Find library needed for gethostbyname:
CHECK_FUNCTION_EXISTS("gethostbyname" CMAKE_HAVE_GETHOSTBYNAME)
IF (NOT CMAKE_HAVE_GETHOSTBYNAME)
CHECK_LIBRARY_EXISTS("nsl" "gethostbyname" "" CMAKE_HAVE_GETHOSTBYNAME)
ENDIF ()
# Find library needed for connect:
CHECK_FUNCTION_EXISTS("connect" CMAKE_HAVE_CONNECT)
IF (NOT CMAKE_HAVE_CONNECT)
CHECK_LIBRARY_EXISTS("socket" "connect" "" CMAKE_HAVE_CONNECT)
ENDIF ()
# Define HAVE_NET_SERVICES if gethostbyname & connect were found:
IF (CMAKE_HAVE_GETHOSTBYNAME AND CMAKE_HAVE_CONNECT)
ADD_DEFINITIONS(-DHAVE_NET_SERVICES)
CHECK_SYMBOL_EXISTS(fmemopen "stdio.h" HAVE_FMEMOPEN)
IF(HAVE_FMEMOPEN)
ADD_DEFINITIONS(-DHAVE_FMEMOPEN)
ENDIF()
ENDIF()
ENDIF()
# Microsoft Visual Studio:
IF(MSVC OR BORLAND) IF(MSVC OR BORLAND)
# Define # Define
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE) ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
# Need an empty unistd.h in MSVC for flex-generated eval_l.c: # Need an empty unistd.h in MSVC for flex-generated eval_l.c:
FILE(WRITE ${CMAKE_SOURCE_DIR}/unistd.h "") FILE(WRITE ${CMAKE_SOURCE_DIR}/unistd.h "")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
ENDIF() ENDIF()
IF(BORLAND) IF(BORLAND)
# Suppress spurious Borland compiler warnings about "Suspicious # Suppress spurious Borland compiler warnings about "Suspicious
# pointer arithmetic", "Possibly incorrect assignment", and # pointer arithmetic", "Possibly incorrect assignment", and
# "Comparing signed and unsigned values". # "Comparing signed and unsigned values".
ADD_DEFINITIONS(-w-spa) ADD_DEFINITIONS(-w-spa)
ADD_DEFINITIONS(-w-pia) ADD_DEFINITIONS(-w-pia)
ADD_DEFINITIONS(-w-csu) ADD_DEFINITIONS(-w-csu)
ENDIF() ENDIF()
#add_subdirectory (src) IF(CFITSIO_USE_SSE2)
IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR
SET (LIB_TYPE STATIC) "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR
IF (BUILD_SHARED_LIBS) "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
SET (LIB_TYPE SHARED) ADD_COMPILE_OPTIONS(-msse2)
ENDIF (BUILD_SHARED_LIBS) ENDIF()
IF(MSVC)
FILE(GLOB H_FILES "*.h") ADD_DEFINITIONS(-D__SSE2__=1)
ENDIF()
ENDIF()
IF (USE_PTHREADS) IF(CFITSIO_USE_SSSE3)
FIND_PACKAGE(pthreads REQUIRED) IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR
INCLUDE_DIRECTORIES(${PTHREADS_INCLUDE_DIR}) "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR
ADD_DEFINITIONS(-D_REENTRANT) "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
ADD_COMPILE_OPTIONS(-mssse3)
ENDIF()
IF(MSVC)
ADD_DEFINITIONS(-D__SSE2__=1 -D__SSSE3__=1)
ENDIF()
ENDIF() ENDIF()
# Math library (not available in MSVC or MINGW) # Test for the unix ftruncate function
IF (MSVC OR MINGW) CHECK_SYMBOL_EXISTS(ftruncate "unistd.h" HAVE_FTRUNCATE)
SET(M_LIB "") IF(HAVE_FTRUNCATE)
ELSE() ADD_DEFINITIONS(-DHAVE_UNISTD_H -DHAVE_FTRUNCATE)
FIND_LIBRARY(M_LIB m)
ENDIF() ENDIF()
# Support for remote file drivers is not implemented for native Windows: # Check is System V IPC is supported on this machine
IF (NOT MSVC) CHECK_C_SOURCE_COMPILES("
# Find library needed for gethostbyname: #include <sys/ipc.h>
CHECK_FUNCTION_EXISTS("gethostbyname" CMAKE_HAVE_GETHOSTBYNAME) #include <sys/shm.h>
IF(NOT CMAKE_HAVE_GETHOSTBYNAME) #include <sys/sem.h>
CHECK_LIBRARY_EXISTS("nsl" "gethostbyname" "" CMAKE_HAVE_GETHOSTBYNAME) int main() {
shmat(0,0,0);
shmdt(0);
shmget(0, 0, 0);
semget(0, 0, 0);
return 0;
}" HAVE_SHMEM_SERVICES)
IF(HAVE_SHMEM_SERVICES)
ADD_DEFINITIONS(-DHAVE_SHMEM_SERVICES)
# Some systems define flock_t, for others we have to define it ourselves
CHECK_C_SOURCE_COMPILES("
#include <sys/flock.h>
int main() {
flock_t filler;
return 0;
}" HAVE_FLOCK_T)
IF(HAVE_FLOCK_T)
ADD_DEFINITIONS(-DHAVE_FLOCK_T)
ENDIF() ENDIF()
# Find library needed for connect: # Check union semun
CHECK_FUNCTION_EXISTS("connect" CMAKE_HAVE_CONNECT) CHECK_C_SOURCE_COMPILES("
IF(NOT CMAKE_HAVE_CONNECT) #include <sys/ipc.h>
CHECK_LIBRARY_EXISTS("socket" "connect" "" CMAKE_HAVE_CONNECT) #include <sys/shm.h>
#include <sys/sem.h>
int main() {
union semun filler;
return 0;
}" HAVE_UNION_SEMUN)
IF(HAVE_UNION_SEMUN)
ADD_DEFINITIONS(-DHAVE_UNION_SEMUN)
ENDIF() ENDIF()
ENDIF()
# Define HAVE_NET_SERVICES if gethostbyname & connect were found: IF(WIN32 AND BUILD_SHARED_LIBS)
IF (CMAKE_HAVE_GETHOSTBYNAME AND CMAKE_HAVE_CONNECT) ADD_DEFINITIONS(-Dcfitsio_EXPORTS)
ADD_DEFINITIONS(-DHAVE_NET_SERVICES)
ENDIF ()
# Find curl library, for HTTPS support:
IF (UseCurl)
FIND_PACKAGE(CURL)
IF (CURL_FOUND)
INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIR})
ADD_DEFINITIONS(-DCFITSIO_HAVE_CURL)
ENDIF()
ENDIF()
ENDIF() ENDIF()
#==============================================================================
# CFITSIO source code:
#==============================================================================
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}")
set (LIB_DESTINATION "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}")
set (INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include/")
set (BIN_DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
SET(H_FILES fitsio.h fitsio2.h longnam.h)
SET(SRC_FILES SET(SRC_FILES
buffers.c cfileio.c checksum.c buffers.c cfileio.c checksum.c
drvrfile.c drvrmem.c drvrnet.c drvrfile.c drvrmem.c drvrnet.c drvrsmem.c
editcol.c edithdu.c eval_f.c eval_l.c eval_y.c editcol.c edithdu.c eval_f.c eval_l.c eval_y.c
f77_wrap1.c f77_wrap2.c f77_wrap3.c f77_wrap4.c f77_wrap1.c f77_wrap2.c f77_wrap3.c f77_wrap4.c
fits_hcompress.c fits_hdecompress.c fitscore.c fits_hcompress.c fits_hdecompress.c fitscore.c
getcol.c getcolb.c getcold.c getcole.c getcoli.c getcolj.c getcolk.c getcol.c getcolb.c getcold.c getcole.c getcoli.c getcolj.c getcolk.c
getcoll.c getcols.c getcolsb.c getcolui.c getcoluj.c getcoluk.c getcoll.c getcols.c getcolsb.c getcolui.c getcoluj.c getcoluk.c
getkey.c group.c grparser.c histo.c imcompress.c iraffits.c modkey.c getkey.c group.c grparser.c histo.c imcompress.c iraffits.c modkey.c
pliocomp.c pliocomp.c
putcol.c putcolb.c putcold.c putcole.c putcoli.c putcolj.c putcolk.c putcol.c putcolb.c putcold.c putcole.c putcoli.c putcolj.c putcolk.c
putcoll.c putcols.c putcolsb.c putcolu.c putcolui.c putcoluj.c putcoluk.c putcoll.c putcols.c putcolsb.c putcolu.c putcolui.c putcoluj.c putcoluk.c
putkey.c quantize.c region.c ricecomp.c scalnull.c simplerng.c swapproc.c putkey.c quantize.c region.c ricecomp.c scalnull.c simplerng.c swapproc.c
wcssub.c wcsutil.c zlib/zcompress.c zlib/zuncompress.c wcssub.c wcsutil.c zcompress.c zuncompress.c
) )
# For future modifications: # For future modifications:
# drvrsmem.c is only usable if HAVE_SHMEM_SERVICES is defined: # drvrsmem.c is only usable if HAVE_SHMEM_SERVICES is defined:
#drvrsmem.c #drvrsmem.c
# drvrgsiftp.c is only usable if HAVE_NET_SERVICES & HAVE_GSIFTP are defined: # drvrgsiftp.c is only usable if HAVE_NET_SERVICES & HAVE_GSIFTP are defined:
#drvrgsiftp.c #drvrgsiftp.c
# Only include zlib source files if we are building a shared library. #==============================================================================
# Users will need to link their executable with zlib independently. # Add libraries:
IF (BUILD_SHARED_LIBS) #==============================================================================
set(SRC_FILES ${SRC_FILES}
zlib/adler32.c zlib/crc32.c zlib/deflate.c zlib/infback.c
zlib/inffast.c zlib/inflate.c zlib/inftrees.c zlib/trees.c
zlib/uncompr.c zlib/zutil.c
)
ENDIF()
ADD_LIBRARY(${LIB_NAME} ${LIB_TYPE} ${H_FILES} ${SRC_FILES}) ADD_LIBRARY(${LIB_NAME} ${LIB_TYPE} ${H_FILES} ${SRC_FILES})
TARGET_LINK_LIBRARIES(${LIB_NAME} ${PTHREADS_LIBRARY} ${M_LIB}) # Math:
TARGET_LINK_LIBRARIES(${LIB_NAME} ${M_LIB})
# zlib:
IF (ZLIB_FOUND)
TARGET_INCLUDE_DIRECTORIES(${LIB_NAME} PUBLIC ${ZLIB_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(${LIB_NAME} ${ZLIB_LIBRARIES})
ENDIF(ZLIB_FOUND)
# cURL:
IF (CURL_FOUND) IF (CURL_FOUND)
TARGET_INCLUDE_DIRECTORIES(${LIB_NAME} PUBLIC ${CURL_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(${LIB_NAME} ${CURL_LIBRARIES}) TARGET_LINK_LIBRARIES(${LIB_NAME} ${CURL_LIBRARIES})
ENDIF(CURL_FOUND) ENDIF(CURL_FOUND)
# PThreads:
IF (THREADS_FOUND)
TARGET_LINK_LIBRARIES(${LIB_NAME} Threads::Threads)
ENDIF(THREADS_FOUND)
# BZip2:
IF (BZIP2_FOUND)
TARGET_INCLUDE_DIRECTORIES(${LIB_NAME} PUBLIC ${BZIP2_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(${LIB_NAME} ${BZIP2_LIBRARIES})
ENDIF(BZIP2_FOUND)
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES VERSION ${${PROJECT_NAME}_VERSION} SOVERSION ${${PROJECT_NAME}_MAJOR_VERSION}) SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES VERSION ${${PROJECT_NAME}_VERSION} SOVERSION ${${PROJECT_NAME}_MAJOR_VERSION})
install(TARGETS ${LIB_NAME} DESTINATION ${LIB_DESTINATION}) install(TARGETS ${LIB_NAME} DESTINATION ${LIB_DESTINATION})
install(TARGETS ${LIB_NAME} install(TARGETS ${LIB_NAME}
RUNTIME DESTINATION bin RUNTIME DESTINATION bin
LIBRARY DESTINATION lib LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib) ARCHIVE DESTINATION lib)
install(FILES ${H_FILES} DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel) install(FILES ${H_FILES} DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel)
# Only build test code and executables if building a shared library: #==============================================================================
IF (BUILD_SHARED_LIBS) # Optional test programs:
#==============================================================================
IF (TESTS)
ENABLE_TESTING() ENABLE_TESTING()
ADD_EXECUTABLE(TestProg testprog.c) ADD_EXECUTABLE(TestProg testprog.c)
TARGET_LINK_LIBRARIES(TestProg ${LIB_NAME}) TARGET_LINK_LIBRARIES(TestProg ${LIB_NAME})
ADD_TEST(TestProg TestProg) ADD_TEST(TestProg TestProg)
# Copy testprog.tpt to build directory to allow quick test # Copy testprog.tpt to build directory to allow quick test
# of ./TestProg (or .\Release\TestProg.exe in MSVC): # of ./TestProg (or .\Release\TestProg.exe in MSVC):
FILE(COPY ${CMAKE_SOURCE_DIR}/testprog.tpt DESTINATION ${CMAKE_CURRENT_BINAR Y_DIR}) FILE(COPY ${CMAKE_SOURCE_DIR}/testprog.tpt DESTINATION ${CMAKE_CURRENT_BINAR Y_DIR})
ADD_EXECUTABLE(cookbook cookbook.c) ADD_EXECUTABLE(cookbook cookbook.c)
TARGET_LINK_LIBRARIES(cookbook ${LIB_NAME}) TARGET_LINK_LIBRARIES(cookbook ${LIB_NAME})
ADD_TEST(cookbook cookbook) ADD_TEST(cookbook cookbook)
ENDIF(TESTS)
#==============================================================================
# Optional utilities:
#==============================================================================
IF (UTILS)
ADD_EXECUTABLE(FPack fpack.c fpackutil.c) ADD_EXECUTABLE(FPack fpack.c fpackutil.c)
TARGET_LINK_LIBRARIES(FPack ${LIB_NAME}) TARGET_LINK_LIBRARIES(FPack ${LIB_NAME})
ADD_EXECUTABLE(Funpack funpack.c fpackutil.c) ADD_EXECUTABLE(Funpack funpack.c fpackutil.c)
TARGET_LINK_LIBRARIES(Funpack ${LIB_NAME}) TARGET_LINK_LIBRARIES(Funpack ${LIB_NAME})
ADD_EXECUTABLE(Fitscopy fitscopy.c) ADD_EXECUTABLE(Fitscopy fitscopy.c)
TARGET_LINK_LIBRARIES(Fitscopy ${LIB_NAME}) TARGET_LINK_LIBRARIES(Fitscopy ${LIB_NAME})
# To expand the command line arguments in Windows, see: # To expand the command line arguments in Windows, see:
# http://msdn.microsoft.com/en-us/library/8bch7bkk.aspx # http://msdn.microsoft.com/en-us/library/8bch7bkk.aspx
if(MSVC) if(MSVC)
set_target_properties(FPack Funpack PROPERTIES LINK_FLAGS "setargv.obj") set_target_properties(FPack Funpack PROPERTIES LINK_FLAGS "setargv.obj")
endif(MSVC) endif(MSVC)
ENDIF(BUILD_SHARED_LIBS) install(TARGETS FPack Funpack Fitscopy RUNTIME DESTINATION bin)
ENDIF(UTILS)
#==============================================================================
# cfitsio.pc
#==============================================================================
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cfitsio.pc.cmake ${CMAKE_CURRENT_BINA RY_DIR}/cfitsio.pc @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cfitsio.pc.cmake ${CMAKE_CURRENT_BINA RY_DIR}/cfitsio.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cfitsio.pc DESTINATION lib/pkgconfig/) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cfitsio.pc DESTINATION lib/pkgconfig/)
 End of changes. 27 change blocks. 
74 lines changed or deleted 224 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)