1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
|
## This whole directory exists just so I could define this extra preprocessor value.
add_definitions(-DSimTK_SIMMATH_BUILDING_SHARED_LIBRARY)
#
# Set up file groups for better browsing in Visual Studio.
#
# Override Api headers to put them in the Api group.
source_group("Header Files\\Api" FILES ${API_ABS_INCLUDE_FILES})
# Now put things in their specified groups.
if(SOURCE_GROUPS)
list(LENGTH SOURCE_GROUPS NGROUPS)
math(EXPR lastgrpnum ${NGROUPS}-1)
foreach( grpnum RANGE 0 ${lastgrpnum} )
list(GET SOURCE_GROUPS ${grpnum} grp)
list(GET SOURCE_GROUP_FILES ${grpnum} grpfile)
source_group("${grp}" FILES "${grpfile}")
endforeach()
endif()
# These are defaults for files that don't otherwise get mentioned.
source_group("Source Files\\Others" FILES ${SOURCE_FILES})
source_group("Header Files\\Others" FILES ${SOURCE_INCLUDE_FILES})
if(BUILD_UNVERSIONED_LIBRARIES)
add_library(${SHARED_TARGET} SHARED
${SOURCE_FILES} ${SOURCE_INCLUDE_FILES}
${API_ABS_INCLUDE_FILES})
target_link_libraries(${SHARED_TARGET}
${SimTKCOMMON_SHARED_LIBRARY}
${MATH_LIBS_TO_USE})
set_target_properties(${SHARED_TARGET} PROPERTIES
PROJECT_LABEL "Code - ${SHARED_TARGET}"
SOVERSION ${SIMBODY_SONAME_VERSION})
# install library; on Windows both .lib and .dll go in the lib directory.
install(TARGETS ${SHARED_TARGET} EXPORT SimbodyTargets
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_WRITE GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
if(NOT ${CMAKE_VERSION} VERSION_LESS 3.0.2)
# This removes the need for client projects to use
# `include_directories(${Simbody_INCLUDE_DIR})`. However, this ability
# was only introduced in CMake 3.0.
target_include_directories(${SHARED_TARGET} INTERFACE
$<INSTALL_INTERFACE:${SIMBODY_INCLUDE_INSTALL_DIR}>
)
endif()
if(SIMBODY_COVERAGE)
add_coverage(${SHARED_TARGET})
endif()
endif(BUILD_UNVERSIONED_LIBRARIES)
if(BUILD_VERSIONED_LIBRARIES)
add_library(${SHARED_TARGET_VN} SHARED
${SOURCE_FILES} ${SOURCE_INCLUDE_FILES}
${API_ABS_INCLUDE_FILES})
target_link_libraries(${SHARED_TARGET_VN}
${SimTKCOMMON_SHARED_LIBRARY_VN}
${MATH_LIBS_TO_USE_VN})
set_target_properties(${SHARED_TARGET_VN} PROPERTIES
PROJECT_LABEL "Code - ${SHARED_TARGET_VN}"
SOVERSION ${SIMBODY_SONAME_VERSION})
# install library; on Windows both .lib and .dll go in the lib directory.
install(TARGETS ${SHARED_TARGET_VN} EXPORT SimbodyTargets
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_WRITE GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
if(NOT ${CMAKE_VERSION} VERSION_LESS 3.0.2)
target_include_directories(${SHARED_TARGET_VN} INTERFACE
$<INSTALL_INTERFACE:${SIMBODY_INCLUDE_INSTALL_DIR}>
)
endif()
if(SIMBODY_COVERAGE)
add_coverage(${SHARED_TARGET_VN})
endif()
endif(BUILD_VERSIONED_LIBRARIES)
|