2017-06-24 07:25:31 +08:00
|
|
|
cmake_minimum_required(VERSION 3.8)
|
|
|
|
project(rtmidi CXX)
|
2017-06-24 07:37:25 +08:00
|
|
|
|
2017-06-29 05:26:44 +08:00
|
|
|
add_library(rtmidi RtMidi.cpp rtmidi_c.cpp)
|
2017-06-24 07:31:26 +08:00
|
|
|
if(BUILD_SHARED_LIBS)
|
2017-06-24 07:25:31 +08:00
|
|
|
target_compile_definitions(rtmidi PRIVATE -DRTMIDI_EXPORT)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
file(READ "${PROJECT_SOURCE_DIR}/rtmidi_c.h" RTMIDI_EXPORT)
|
2017-06-24 07:33:25 +08:00
|
|
|
if (BUILD_SHARED_LIBS)
|
2017-06-24 07:25:31 +08:00
|
|
|
string(REPLACE "if defined(RTMIDI_EXPORT)" "if 1" RTMIDI_EXPORT "${RTMIDI_EXPORT}")
|
|
|
|
else()
|
|
|
|
string(REPLACE "if defined(RTMIDI_EXPORT)" "if 0" RTMIDI_EXPORT "${RTMIDI_EXPORT}")
|
|
|
|
endif()
|
|
|
|
file(WRITE "${PROJECT_BINARY_DIR}/rtmidi_c.h" "${RTMIDI_EXPORT}")
|
|
|
|
|
|
|
|
install(
|
|
|
|
TARGETS rtmidi
|
|
|
|
RUNTIME DESTINATION bin
|
|
|
|
LIBRARY DESTINATION lib
|
|
|
|
ARCHIVE DESTINATION lib
|
|
|
|
)
|
|
|
|
|
|
|
|
if(NOT DISABLE_INSTALL_HEADERS)
|
2017-06-29 05:26:44 +08:00
|
|
|
install(FILES "RtMidi.h" DESTINATION include)
|
2017-06-24 07:25:31 +08:00
|
|
|
install(FILES "${PROJECT_BINARY_DIR}/rtmidi_c.h" DESTINATION include)
|
|
|
|
endif()
|