--- CMakeLists.txt 2009-09-07 12:07:00.000000000 +0200 +++ CMakeLists2.txt 2010-02-19 16:46:28.000000000 +0100 @@ -1,6 +1,11 @@ project(charls) cmake_minimum_required(VERSION 2.6) - + +SET(CHARLS_LIB_MAJOR_VERSION 1) +SET(CHARLS_LIB_MINOR_VERSION 0) + +SET( charls_HEADERS "colortransform.h" "context.h" "decoderstrategy.h" "encoderstrategy.h" "interface.h" "losslesstraits.h" "scan.h" "streams.h" "config.h" "contextrunmode.h" "defaulttraits.h" "header.h" "lookuptable.h" "processline.h" "stdafx.h" "util.h" +) # When user specify build type do not override settings: IF(NOT CMAKE_BUILD_TYPE) @@ -12,14 +17,29 @@ OPTION(charls_BUILD_SHARED_LIBS "Build CharLS with shared libraries." OFF) SET(BUILD_SHARED_LIBS ${charls_BUILD_SHARED_LIBS}) - -add_library(CharLS header.cpp interface.cpp jpegls.cpp - stdafx.cpp - ) + +IF(BUILD_SHARED_LIBS) + add_library(CharLS SHARED header.cpp interface.cpp jpegls.cpp + stdafx.cpp + ) + set_target_properties( CharLS PROPERTIES + VERSION ${CHARLS_LIB_MAJOR_VERSION}.${CHARLS_LIB_MINOR_VERSION} + SOVERSION ${CHARLS_LIB_MAJOR_VERSION} + ) + +ENDIF(BUILD_SHARED_LIBS) add_executable(charlstest test/test.cpp test/time.cpp) -target_link_libraries (charlstest CharLS) +target_link_libraries (charlstest CharLS) include(CTest) -add_test(charlstest charlstest) \ No newline at end of file +add_test(charlstest charlstest) + +# Installs the header files into the {build_dir}/include/libcharls directory +install(FILES ${charls_HEADERS} DESTINATION include/CharLS) + +# Installs the target file (libCharLS.so) into the {build_dir}/lib directory +install(TARGETS CharLS LIBRARY DESTINATION lib${LIB_SUFFIX}) + +