Changeset 1811 for trunk/src


Ignore:
Timestamp:
04/02/12 23:07:45 (4 months ago)
Author:
Freddie Akeroyd
Message:
  • Some general CMake code refactoring
  • Improve locating of external libraries
  • Add in more OS function tests and create nxconfig.h

Refs #327

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/CMakeLists.txt

    r1794 r1811  
    2727#==================================================================== 
    2828 
    29 add_definitions(-DIN_NEXUS_LIBRARY ${HDF5_DEFINITIONS} ${HDF5_CPP} ${HDF4_CPP} ${MXML_CPP} ${NX_CPP}) 
     29add_definitions(-DIN_NEXUS_LIBRARY ${NX_CPP}) 
    3030 
    3131set (NAPISRC napi.c napiu.c nxstack.c nxstack.h stptok.c  nxdataset.c nxdataset.h nx_stptok.h) 
    3232 
    33 if (HDF4_FOUND) 
     33if (HAVE_HDF4) 
    3434  set (NAPISRC ${NAPISRC} napi4.c) 
    35 endif (HDF4_FOUND) 
     35  add_definitions(-DHDF4 ${HDF4_DEFINITIONS} ${HDF4_CPP}) 
     36  include_directories(${HDF4_INCLUDE_DIRS}) 
     37endif (HAVE_HDF4) 
    3638 
    37 if (HDF5_FOUND) 
     39if (HAVE_HDF5) 
    3840  set (NAPISRC ${NAPISRC} napi5.c) 
    39 endif (HDF5_FOUND) 
     41  add_definitions(-DHDF5 ${HDF5_DEFINITIONS} ${HDF5_CPP}) 
     42  include_directories(${HDF5_INCLUDE_DIRS}) 
     43endif (HAVE_HDF5) 
     44 
     45if(HAVE_MXML) 
     46    set (NAPISRC ${NAPISRC} nxxml.c nxio.c nxio.h) 
     47    add_definitions(-DNXXML ${MXML_DEFINITIONS} ${MXML_CPP}) 
     48        include_directories(${MXML_INCLUDE_DIRS}) 
     49endif(HAVE_MXML) 
    4050 
    4151# need napi_exports2.c  on win32 but not win64 
     
    4858endif (WIN32) 
    4959 
    50 if(HAVE_XML) 
    51     set (NAPISRC ${NAPISRC} nxxml.c nxio.c nxio.h) 
    52 endif(HAVE_XML) 
    53  
    54 set (NAPISRC ${NAPISRC} nxxml.c nxio.c nxio.h) 
    55  
    5660set_property(SOURCE ${NAPISRC} APPEND PROPERTY COMPILE_FLAGS ${NX_CFLAGS}) 
    5761 
     
    5963 
    6064set (NX_LIBS  ${HDF4_LINK} ${READLINE_LINK} ${M_LINK} ${DL_LINK} ${PTHREAD_LINK} ${DF_LINK} 
    61                       ${TERMCAP_LINK} ${HISTORY_LINK} ${JPEG_LIBRARIES} ${ZIP_LIB} ${SZIP_LIB} ) 
     65                      ${TERMCAP_LINK} ${HISTORY_LINK} ${JPEG_LIBRARIES} ${SZIP_LIBRARIES} ${ZLIB_LIBRARIES} ) 
    6266#if (MINGW_MSYS) 
    6367#  set (MINGW_SRC napi_exports.c napi_exports2.c napi_exports.h) 
     
    8286set_target_properties(NeXus_Static_Library PROPERTIES OUTPUT_NAME NeXusStatic) 
    8387 
    84 target_link_libraries(NeXus_Static_Library ${HDF5_STATIC_LIBRARIES} ${HDF4_STATIC_LIBRARIES} ${NX_LIBS}) 
     88target_link_libraries(NeXus_Static_Library ${HDF5_STATIC_LIBRARIES} ${HDF4_STATIC_LIBRARIES} ${MXML_STATIC_LIBRARIES}  ${NX_LIBS}) 
    8589 
    8690#Make NeXus Shared Library 
     
    106110endif (${CMAKE_SYSTEM_NAME} MATCHES "Windows") 
    107111 
    108 target_link_libraries(NeXus_Shared_Library ${HDF5_SHARED_LIBRARIES} ${HDF4_SHARED_LIBRARIES} ${NX_LIBS}) 
     112target_link_libraries(NeXus_Shared_Library ${HDF5_SHARED_LIBRARIES} ${HDF4_SHARED_LIBRARIES} ${MXML_SHARED_LIBRARIES} ${NX_LIBS}) 
    109113 
    110 if(HAVE_XML) 
    111 if(MXMLLIB_FOUND) 
    112     target_link_libraries(NeXus_Static_Library ${MXML}) 
    113     target_link_libraries(NeXus_Shared_Library ${MXML}) 
    114 else() 
    115     target_link_libraries(NeXus_Static_Library MXML_Static_Library) 
    116     target_link_libraries(NeXus_Shared_Library MXML_Shared_Library) 
    117 endif(MXMLLIB_FOUND) 
    118 endif(HAVE_XML) 
     114#if(HAVE_MXML) 
     115#if(MXMLLIB_FOUND) 
     116#    target_link_libraries(NeXus_Static_Library ${MXML}) 
     117#    target_link_libraries(NeXus_Shared_Library ${MXML}) 
     118#else() 
     119#    target_link_libraries(NeXus_Static_Library MXML_Static_Library) 
     120#    target_link_libraries(NeXus_Shared_Library MXML_Shared_Library) 
     121#endif(MXMLLIB_FOUND) 
     122#endif(HAVE_MXML) 
    119123 
    120124install (TARGETS NeXus_Static_Library NeXus_Shared_Library 
Note: See TracChangeset for help on using the changeset viewer.