diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/compression/CMakeLists.txt | 11 | ||||
-rw-r--r-- | src/lib/CMakeLists.txt | 31 |
2 files changed, 23 insertions, 19 deletions
diff --git a/src/compression/CMakeLists.txt b/src/compression/CMakeLists.txt index 267a45a..3efd6bb 100644 --- a/src/compression/CMakeLists.txt +++ b/src/compression/CMakeLists.txt @@ -1,11 +1,12 @@ -add_library(tng_compress bwlzh.c bwt.c coder.c dict.c fixpoint.c huffman.c huffmem.c lz77.c merge_sort.c mtf.c rle.c tng_compress.c vals16.c warnmalloc.c widemuldiv.c xtc2.c xtc3.c) +set(source_files bwlzh.c bwt.c coder.c dict.c fixpoint.c huffman.c huffmem.c lz77.c merge_sort.c mtf.c rle.c tng_compress.c vals16.c warnmalloc.c widemuldiv.c xtc2.c xtc3.c) + +add_library(tng_compress ${source_files}) + +# Append the required library dependencies if(UNIX) -target_link_libraries(tng_compress m) + target_link_libraries(tng_compress m) endif() -set_property(TARGET tng_compress PROPERTY LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) -set_property(TARGET tng_compress PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) - install(TARGETS tng_compress LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index c760f57..81b5843 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -1,18 +1,18 @@ +set(source_files tng_io.c md5.c) if(TNG_BUILD_FORTRAN) - add_library(tng_io tng_io.c md5.c tng_io_fortran.c) -else() - add_library(tng_io tng_io.c md5.c) + list(APPEND source_files tng_io_fortran.c) endif() -set_property(TARGET tng_io PROPERTY LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) -set_property(TARGET tng_io PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) +add_library(tng_io ${source_files}) -install(TARGETS tng_io - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib) +# Now add source-file compilation properties to the source-file +# targets if(HAVE_INTTYPES_H) - set_property(TARGET tng_io APPEND PROPERTY COMPILE_DEFINITIONS USE_STD_INTTYPES_H) + set_property(SOURCE tng_io.c APPEND PROPERTY COMPILE_DEFINITIONS USE_STD_INTTYPES_H) +endif() +if(TNG_BUILD_WITH_ZLIB) + set_property(SOURCE tng_io.c APPEND PROPERTY COMPILE_DEFINITIONS USE_ZLIB) endif() # This test is for md5. The TNG library itself determines the actual byte order - @@ -20,12 +20,15 @@ endif() include(TestBigEndian) test_big_endian(TNG_INTEGER_BIG_ENDIAN) if(TNG_INTEGER_BIG_ENDIAN) - set_property(TARGET tng_io APPEND PROPERTY COMPILE_DEFINITIONS TNG_INTEGER_BIG_ENDIAN) + set_property(SOURCE md5.c APPEND PROPERTY COMPILE_DEFINITIONS TNG_INTEGER_BIG_ENDIAN) endif() +# Append the required library dependencies +target_link_libraries(tng_io tng_compress) if(TNG_BUILD_WITH_ZLIB) - set_property(TARGET tng_io APPEND PROPERTY COMPILE_DEFINITIONS USE_ZLIB) - target_link_libraries(tng_io tng_compress ${ZLIB_LIBRARIES}) -else() - target_link_libraries(tng_io tng_compress) + target_link_libraries(tng_io ${ZLIB_LIBRARIES}) endif() + +install(TARGETS tng_io + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) |