diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e4a144e9..aad4bfe21 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,8 @@ project(qthreads DESCRIPTION "A user-level threading library" LANGUAGES C ASM) +include(GNUInstallDirs) + add_subdirectory(src) if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d585f8143..4622be881 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -42,11 +42,36 @@ set(QTHREADS_SOURCES add_library(qthread SHARED ${QTHREADS_SOURCES}) target_include_directories(qthread - PUBLIC "../include/qthread" PRIVATE "../include" ) +target_include_directories(qthread + PUBLIC + $ + $ +) # TODO: move these into a configure header instead of piping them through the flags. target_compile_definitions(qthread PRIVATE CACHELINE_WIDTH=${QTHREADS_CACHELINE_SIZE_ESTIMATE} PRIVATE QTHREAD_DEFAULT_STACK_SIZE=${QTHREADS_DEFAULT_STACK_SIZE} ) + +#file(GLOB QTHREADS_INTERNAL_HEADERS "../include/*.h") +file(GLOB QTHREADS_PUBLIC_HEADERS "../include/qthread/*.h*") + +target_sources(qthread + PUBLIC + FILE_SET qthreads_public_headers + TYPE HEADERS + BASE_DIRS "../include" + FILES ${QTHREADS_PUBLIC_HEADERS} +) + +install( + TARGETS qthread + EXPORT qthread + LIBRARY + DESTINATION "${CMAKE_INSTALL_LIBDIR}" + COMPONENT shlib + FILE_SET qthreads_public_headers +) +install(EXPORT qthread DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/qthread")