Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup For Installation Using CMake #317

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
27 changes: 26 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/qthread>
)
# 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")