Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
VegaFEM-CMake
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ben Boeckel
VegaFEM-CMake
Commits
4d5b70be
Commit
4d5b70be
authored
5 years ago
by
Aaron Bray
Browse files
Options
Downloads
Patches
Plain Diff
Support finding both debug and optimized pthread libraries
parent
7bc1bda6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CMake/FindPThreads.cmake
+23
-9
23 additions, 9 deletions
CMake/FindPThreads.cmake
with
23 additions
and
9 deletions
CMake/FindPThreads.cmake
+
23
−
9
View file @
4d5b70be
find_path
(
PTHREAD_INCLUDE_DIR
find_path
(
PTHREAD_INCLUDE_DIR
pthread.h
pthread.h
)
)
set
(
PTHREAD_INCLUDE_DIR
${
PTHREAD_INCLUDE_DIR
}
)
find_library
(
PTHREAD_LIBRARY
find_library
(
PTHREAD_
RELEASE_
LIBRARY
NAMES
NAMES
pthread
pthread
libpthread
libpthread
)
)
if
(
EXISTS
${
PTHREAD_RELEASE_LIBRARY
}
)
set
(
PTHREAD_INCLUDE_DIRS
"
${
PTHREAD_INCLUDE_DIR
}
"
)
list
(
APPEND PTHREAD_LIBRARIES optimized
${
PTHREAD_RELEASE_LIBRARY
}
)
set
(
PTHREAD_LIBRARIES
"
${
PTHREAD_LIBRARY
}
"
)
endif
()
find_library
(
PTHREAD_DEBUG_LIBRARY
NAMES
pthreadd
libpthreadd
)
if
(
EXISTS
${
PTHREAD_DEBUG_LIBRARY
}
)
list
(
APPEND PTHREAD_LIBRARIES debug
${
PTHREAD_DEBUG_LIBRARY
}
)
endif
()
include
(
FindPackageHandleStandardArgs
)
include
(
FindPackageHandleStandardArgs
)
find_package_handle_standard_args
(
PTHREAD
find_package_handle_standard_args
(
PTHREAD
REQUIRED_VARS
REQUIRED_VARS
PTHREAD_INCLUDE_DIR
PTHREAD_INCLUDE_DIR
PTHREAD_LIBRAR
Y
)
PTHREAD_LIBRAR
IES
)
mark_as_advanced
(
mark_as_advanced
(
PTHREAD_INCLUDE_DIR
PTHREAD_INCLUDE_DIR
PTHREAD_LIBRARY
)
PTHREAD_DEBUG_LIBRARY
PTHREAD_RELEASE_LIBRARY
)
if
(
PTHREAD_FOUND AND NOT TARGET Threads::Threads
)
if
(
PTHREAD_FOUND AND NOT TARGET Threads::Threads
)
add_library
(
Threads::Threads INTERFACE IMPORTED
)
add_library
(
Threads::Threads INTERFACE IMPORTED
)
set_target_properties
(
Threads::Threads PROPERTIES
target_include_directories
(
Threads::Threads INTERFACE
"
${
PTHREAD_INCLUDE_DIR
}
"
)
INTERFACE_LINK_LIBRARIES
"
${
PTHREAD_LIBRARY
}
"
if
(
EXISTS
${
PTHREAD_DEBUG_LIBRARY
}
)
INTERFACE_INCLUDE_DIRECTORIES
"
${
PTHREAD_INCLUDE_DIRS
}
"
)
target_link_libraries
(
Threads::Threads INTERFACE debug
${
PTHREAD_DEBUG_LIBRARY
}
)
endif
()
if
(
EXISTS
${
PTHREAD_RELEASE_LIBRARY
}
)
target_link_libraries
(
Threads::Threads INTERFACE optimized
${
PTHREAD_RELEASE_LIBRARY
}
)
endif
()
endif
()
endif
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment