diff --git a/.cmake/DependencyDetection.cmake b/.cmake/DependencyDetection.cmake new file mode 100644 index 000000000..c49540cc9 --- /dev/null +++ b/.cmake/DependencyDetection.cmake @@ -0,0 +1,20 @@ +macro(find_vendor_library target_var library_name) + find_library(${target_var} NAMES ${library_name} PATHS ${VENDOR_LINK_DIRECTORIES} NO_DEFAULT_PATH NO_CACHE) + message(STATUS "[dependency-detection] ${BoldBlue}'${library_name}' library resolved to '${${target_var}}'${ColorReset}") +endmacro(find_vendor_library) + +macro(find_header header_name) + find_path(TEMP ${header_name} HINTS ${PROJECT_INCLUDE_DIRECTORIES} REQUIRED NO_CACHE) + if (${TEMP} MATCHES "TEMP-NOTFOUND") + message(STATUS "[dependency-detection] ${BoldRed}'${header_name}' COULD NOT BE FOUND!${ColorReset}") + else() + message(STATUS "[dependency-detection] ${BoldBlue}'${header_name}' resolved to '${TEMP}'${ColorReset}") + endif() + unset(TEMP) +endmacro(find_library_and_header) + +macro(find_library_and_header target_var library_name header_name) + find_library(${target_var} NAMES ${library_name} NO_CACHE) + message(STATUS "[dependency-detection] ${BoldBlue}'${library_name}' library resolved to '${${target_var}}'${ColorReset}") + find_header(${header_name}) +endmacro(find_library_and_header) diff --git a/.cmake/FindVendorLibrary.cmake b/.cmake/FindVendorLibrary.cmake deleted file mode 100644 index 5f95685ef..000000000 --- a/.cmake/FindVendorLibrary.cmake +++ /dev/null @@ -1,17 +0,0 @@ -macro(find_vendor_library target_var library_name) - find_library(${target_var} NAMES ${library_name} PATHS ${VENDOR_LINK_DIRECTORIES} NO_DEFAULT_PATH NO_CACHE) - message(STATUS "[find-vendor-library] ${BoldBlue}'${library_name}' library resolved to '${${target_var}}'${ColorReset}") -endmacro(find_vendor_library) - -macro(find_library_and_header target_var library_name header_name) - find_library(${target_var} NAMES ${library_name} NO_CACHE) - message(STATUS "[find-library-and-header] ${BoldBlue}'${library_name}' library resolved to '${${target_var}}'${ColorReset}") - - find_path(TEMP ${header_name} REQUIRED NO_CACHE) - if (${TEMP} MATCHES "TEMP-NOTFOUND") - message(STATUS "[find-library-and-header] ${BoldRed}'${header_name}' COULD NOT BE FOUND!${ColorReset}") - else() - message(STATUS "[find-library-and-header] ${BoldBlue}'${header_name}' resolved to '${TEMP}'${ColorReset}") - endif() - unset(TEMP) -endmacro(find_library_and_header) diff --git a/CMakeLists.txt b/CMakeLists.txt index 59af0afa5..0d513f1c7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,7 +27,7 @@ include(AddDarwinSystemLibs) include(AddLinuxSystemLibs) include(ConfigureCurses) include(ConfigureCompilerFlags) -include(FindVendorLibrary) +include(DependencyDetection) if (NOT DEFINED ENV{HOMEBREW_PREFIX} AND NOT ${BUILD_STANDALONE} MATCHES "true") find_program(CCACHE_FOUND ccache) @@ -52,7 +52,9 @@ message(STATUS "[vendor-link-directories] ${VENDOR_LINK_DIRECTORIES}") message(STATUS "[vendor-include-directories] ${VENDOR_INCLUDE_DIRECTORIES}") message(STATUS "[os-system-libs] ${DEFAULT_OS_SYSTEM_LIBS}") -include_directories( +list( + APPEND + PROJECT_INCLUDE_DIRECTORIES "${musikcube_SOURCE_DIR}/src" "${musikcube_SOURCE_DIR}/src/musikcore" "${musikcube_SOURCE_DIR}/src/musikcube" @@ -60,6 +62,8 @@ include_directories( "${musikcube_SOURCE_DIR}/src/3rdparty/include" "${musikcube_SOURCE_DIR}/src/3rdparty/asio/asio/include") +include_directories(${PROJECT_INCLUDE_DIRECTORIES}) + link_directories("${musikcube_SOURCE_DIR}/bin/plugins") # these are used to (1) disable the standalone ASIO from trying to use diff --git a/src/musikcore/CMakeLists.txt b/src/musikcore/CMakeLists.txt index 415306a05..9d47f977b 100644 --- a/src/musikcore/CMakeLists.txt +++ b/src/musikcore/CMakeLists.txt @@ -88,6 +88,7 @@ add_library(musikcore SHARED ${CORE_SOURCES}) set_target_properties(musikcore PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${musikcube_SOURCE_DIR}/bin) target_link_libraries(musikcore ${musikcube_LINK_LIBS}) target_include_directories(musikcore BEFORE PRIVATE ${VENDOR_INCLUDE_DIRECTORIES}) +find_header(asio.hpp) if (ENABLE_PCH MATCHES "true") message(STATUS "[musikcore] enabling precompiled headers")