diff --git a/CMakeLists.txt b/CMakeLists.txt index 687f006..7260c41 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,17 @@ cmake_minimum_required(VERSION 2.8.3) project(hueplusplus) +# uninstall target +if(NOT TARGET uninstall) + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" + IMMEDIATE @ONLY) + + add_custom_target(uninstall + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) +endif() + option(hueplusplus_TESTS "Build tests" OFF) if (1 AND APPLE) diff --git a/cmake_uninstall.cmake.in b/cmake_uninstall.cmake.in new file mode 100644 index 0000000..4c07dc7 --- /dev/null +++ b/cmake_uninstall.cmake.in @@ -0,0 +1,21 @@ +if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") + message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt") +endif(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") + +file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files) +string(REGEX REPLACE "\n" ";" files "${files}") +foreach(file ${files}) + message(STATUS "Uninstalling $ENV{DESTDIR}${file}") + if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") + exec_program( + "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval + ) + if(NOT "${rm_retval}" STREQUAL 0) + message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") + endif(NOT "${rm_retval}" STREQUAL 0) + else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") + message(STATUS "File $ENV{DESTDIR}${file} does not exist.") + endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") +endforeach(file) diff --git a/hueplusplus/CMakeLists.txt b/hueplusplus/CMakeLists.txt index 1127f90..0ae452f 100755 --- a/hueplusplus/CMakeLists.txt +++ b/hueplusplus/CMakeLists.txt @@ -1,10 +1,12 @@ file(GLOB hueplusplus_HEADERS *.h *.hpp) file(GLOB hueplusplus_SOURCES *.cpp) -add_library(HuePlusPlusShared SHARED ${hueplusplus_SOURCES}) -set_property(TARGET HuePlusPlusShared PROPERTY CXX_STANDARD 14) -set_property(TARGET HuePlusPlusShared PROPERTY CXX_EXTENSIONS OFF) +add_library(hueplusplusshared SHARED ${hueplusplus_SOURCES}) +set_property(TARGET hueplusplusshared PROPERTY CXX_STANDARD 14) +set_property(TARGET hueplusplusshared PROPERTY CXX_EXTENSIONS OFF) -add_library(HuePlusPlusStatic STATIC ${hueplusplus_SOURCES}) -set_property(TARGET HuePlusPlusStatic PROPERTY CXX_STANDARD 14) -set_property(TARGET HuePlusPlusStatic PROPERTY CXX_EXTENSIONS OFF) +add_library(hueplusplusstatic STATIC ${hueplusplus_SOURCES}) +set_property(TARGET hueplusplusstatic PROPERTY CXX_STANDARD 14) +set_property(TARGET hueplusplusstatic PROPERTY CXX_EXTENSIONS OFF) +install(TARGETS hueplusplusstatic DESTINATION lib) +install(FILES ${hueplusplus_HEADERS} DESTINATION include)