Commit cf1aaa36 authored by Ghislain MARY's avatar Ghislain MARY

Correctly handle ENABLE_SHARED and ENABLE_STATIC options.

parent 1941abda
......@@ -154,14 +154,20 @@ endif()
if(ENABLE_STATIC)
add_library(bcunit STATIC ${SOURCE_FILES})
add_library(bcunit-static STATIC ${SOURCE_FILES})
set_target_properties(bcunit-static PROPERTIES OUTPUT_NAME bcunit)
if(ANDROID)
target_link_libraries(bcunit INTERFACE "log")
target_link_libraries(bcunit-static INTERFACE "log")
endif()
if(CURSES_LIBRARIES)
target_link_libraries(bcunit INTERFACE ${CURSES_LIBRARIES})
target_link_libraries(bcunit-static INTERFACE ${CURSES_LIBRARIES})
endif()
else()
install(TARGETS bcunit-static EXPORT BcUnitTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
endif()
if(ENABLE_SHARED)
add_library(bcunit SHARED ${SOURCE_FILES})
set_target_properties(bcunit PROPERTIES VERSION 1.0.1)
if(CURSES_LIBRARIES)
......@@ -175,13 +181,13 @@ else()
)
endif()
endif()
install(TARGETS bcunit EXPORT BcUnitTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
endif()
install(TARGETS bcunit EXPORT BcUnitTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
if(ENABLE_TEST)
......
......@@ -31,15 +31,17 @@
include("${CMAKE_CURRENT_LIST_DIR}/BcUnitTargets.cmake")
if(@ENABLE_SHARED@)
set(BCUNIT_LIBRARIES bcunit)
set(BCUNIT_TARGETNAME bcunit)
set(BCUNIT_LIBRARIES ${BCUNIT_TARGETNAME})
else()
get_target_property(BCUNIT_LIBRARIES bcunit LOCATION)
get_target_property(BCUNIT_LINK_LIBRARIES bcunit INTERFACE_LINK_LIBRARIES)
set(BCUNIT_TARGETNAME bcunit-static)
get_target_property(BCUNIT_LIBRARIES ${BCUNIT_TARGETNAME} LOCATION)
get_target_property(BCUNIT_LINK_LIBRARIES ${BCUNIT_TARGETNAME} INTERFACE_LINK_LIBRARIES)
if(BCUNIT_LINK_LIBRARIES)
list(APPEND BCUNIT_LIBRARIES ${BCUNIT_LINK_LIBRARIES})
endif()
endif()
get_target_property(BCUNIT_INCLUDE_DIRS bcunit INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(BCUNIT_INCLUDE_DIRS ${BCUNIT_TARGETNAME} INTERFACE_INCLUDE_DIRECTORIES)
if(NOT BCUNIT_INCLUDE_DIRS)
set(BCUNIT_INCLUDE_DIRS )
endif()
......
......@@ -39,6 +39,9 @@ set(PACKAGE_TARNAME "bcunit")
set(PACKAGE_URL "")
option(ENABLE_SHARED "Build shared library." YES)
option(ENABLE_STATIC "Build static library." YES)
option(ENABLE_AUTOMATED "Compile BCUnit automated interface" ON)
option(ENABLE_BASIC "Compile BCUnit basic interface" ON)
option(ENABLE_CONSOLE "Compile BCUnit console interface" ON)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment