"Fossies" - the Fresh Open Source Software Archive

Member "udunits-2.2.28/lib/CMakeLists.txt" (23 Nov 2020, 2984 Bytes) of package /linux/privat/udunits-2.2.28.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "CMakeLists.txt": 2.2.26_vs_2.2.28.

    1 INCLUDE_DIRECTORIES("." "${CMAKE_BINARY_DIR}")
    2 INCLUDE_DIRECTORIES("${EXPAT_INCLUDE_DIRS}")
    3 IF (CUNIT_INCLUDE_DIR)
    4     INCLUDE_DIRECTORIES("${CUNIT_INCLUDE_DIR}")
    5 ENDIF()
    6 
    7 IF(YY_NO_UNISTD_H)
    8     ADD_DEFINITIONS(-DYY_NO_UNISTD_H)
    9 ENDIF(YY_NO_UNISTD_H)
   10 
   11 ##
   12 # Check to see if we have flex and bison.
   13 ##
   14 FIND_PROGRAM(UD_FLEX NAMES flex)
   15 FIND_PROGRAM(UD_BISON NAMES bison)
   16 
   17 # Ensure that the C source-files for the scanner and parser are up-to-date
   18 # on a Unix system.
   19 #
   20 # MODIFICATION: Instead of checking for Unix, see if flex and bison
   21 # are available.
   22 #
   23 # MODIFICATION 2: Moving back for now, but leaving framework.
   24 #  Other complications arose on Windows with MSVC.
   25 #
   26 
   27 IF(UNIX)
   28     add_custom_command(
   29         OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/scanner.c
   30         WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
   31         COMMAND ${UD_FLEX} -d -Put -o scanner.c scanner.l
   32         DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/scanner.l)
   33     add_custom_command(
   34         OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/parser.c
   35         WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
   36         COMMAND ${UD_BISON} -t -p ut -o parser.c parser.y
   37         DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/parser.y)
   38     set_source_files_properties(parser.c
   39         PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/scanner.c)
   40 endif()
   41 
   42 SET(libudunits2_src converter.c
   43 		    error.c
   44 		    formatter.c
   45 		    idToUnitMap.c
   46 		    parser.c
   47 		    prefix.c
   48 		    status.c
   49 		    systemMap.c
   50 		    unitAndId.c
   51 		    unitcore.c
   52 		    unitToIdMap.c
   53 		    ut_free_system.c
   54 		    xml.c
   55 		    udunits2.h)
   56 
   57 if(MSVC)
   58 	SET(libudunits2_src ${libudunits2_src}
   59 	tsearch.c tsearch.h udunits_snprintf.c)
   60 endif()
   61 
   62 add_library(libudunits2
   63 	${libudunits2_src})	
   64 set_target_properties(libudunits2 PROPERTIES LIBRARY_OUTPUT_NAME udunits2)
   65 set_target_properties(libudunits2 PROPERTIES ARCHIVE_OUTPUT_NAME udunits2)
   66 set_target_properties(libudunits2 PROPERTIES RUNTIME_OUTPUT_NAME udunits2)
   67 target_link_libraries(libudunits2 ${EXPAT_LIBRARIES})
   68 target_link_libraries(libudunits2 ${MATH_LIBRARY})
   69 target_link_libraries(libudunits2 ${CMAKE_DL_LIBS})
   70 
   71 IF(MSVC)
   72 	SET_TARGET_PROPERTIES(libudunits2 PROPERTIES
   73 	LINK_FLAGS_DEBUG " /NODEFAULTLIB:MSVCRT"
   74 )
   75 ENDIF()
   76 
   77 if (CUNIT_LIBRARY)
   78     add_executable(testUnits testUnits.c)
   79     target_link_libraries (testUnits libudunits2)
   80     target_link_libraries (testUnits ${CUNIT_LIBRARY})
   81     add_test(
   82         NAME testUnits
   83         COMMAND testUnits ${CMAKE_CURRENT_SOURCE_DIR}/udunits2.xml)
   84 endif()
   85 
   86 # The documentation is in multiple texinfo(5) format files
   87 texi_doc(udunits2lib.texi ${CMAKE_SOURCE_DIR}/COPYRIGHT)
   88     
   89 install(TARGETS libudunits2 EXPORT udunits2-targets
   90     ARCHIVE DESTINATION lib
   91     LIBRARY DESTINATION lib
   92     RUNTIME DESTINATION bin)
   93 install(FILES udunits2.h converter.h DESTINATION include)
   94 install(FILES
   95         udunits2.xml
   96         udunits2-accepted.xml
   97         udunits2-base.xml
   98         udunits2-common.xml
   99         udunits2-derived.xml
  100         udunits2-prefixes.xml
  101     DESTINATION share/udunits)