Skip to content

[cmake] add_subdirectory support #47

@Challanger524

Description

@Challanger524

Thank you library creators for protecting peoples minds from Microsoft C interfaces!

But why every 3rd library with CMakeLists.txt can't setup a sane project inclusion!?
It is was not hard to create one for this library.

# Setup: odbc-cpp-wrapper (C++ Wrapper for ODBC) #
if(MINGW)
  set(ODBC_INCLUDE_DIR "" CACHE PATH "[MinGW] prevent '../Windows Kits/..' inclusion from VS dev env")
endif()
find_package(ODBC REQUIRED)
file(GLOB_RECURSE ODBCCPP_SOURCE_FILES_ "${CMAKE_SOURCE_DIR}/deps/odbc-cpp-wrapper/src/*.cpp")
add_library               (odbccpp STATIC ${ODBCCPP_SOURCE_FILES_})
target_include_directories(odbccpp SYSTEM PUBLIC  "${CMAKE_SOURCE_DIR}/deps/odbc-cpp-wrapper/src")
target_compile_definitions(odbccpp        PUBLIC  ODBC_STATIC)
target_link_libraries     (odbccpp        PUBLIC  ODBC::ODBC)
set_target_properties     (odbccpp PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON)
target_link_libraries(${PROJECT_NAME} odbccpp)

Should I try to contribute to project's CMakeLists.txt?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions