Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CLHEP
CLHEP
Commits
e3d1d597
Commit
e3d1d597
authored
Apr 19, 2016
by
Lynn Garren
Browse files
use find_package(Threads)
parent
50661210
Changes
1
Hide whitespace changes
Inline
Side-by-side
cmake/Modules/ClhepVariables.cmake
View file @
e3d1d597
...
...
@@ -187,11 +187,11 @@ macro( _clhep_check_cxxstd )
##message(STATUS "_clhep_check_cxxstd debug: CLHEP_BUILD_CXXSTD HAVE_STDCXX: ${CLHEP_BUILD_CXXSTD} ${HAVE_STDCXX}")
if
(
DEFINED HAVE_STDCXX
)
if
(
${
CMAKE_CXX_COMPILER_ID
}
STREQUAL
"Clang"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
${
CLHEP_BUILD_CXXSTD
}
-pthread
"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
${
CLHEP_BUILD_CXXSTD
}
"
)
elseif
(
${
CMAKE_CXX_COMPILER_ID
}
STREQUAL
"Intel"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
${
CLHEP_BUILD_CXXSTD
}
-pthread
"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
${
CLHEP_BUILD_CXXSTD" )
elseif(CMAKE_COMPILER_IS_GNUCXX)
set
(
CMAKE_CXX_FLAGS
"
${
CLHEP_BUILD_CXXSTD
}
-pthread
${
CMAKE_CXX_FLAGS
}
-D_GNU_SOURCE"
)
set( CMAKE_CXX_FLAGS "
${
CLHEP_BUILD_CXXSTD
}
${
CMAKE_CXX_FLAGS
}
-D_GNU_SOURCE" )
else()
message(STATUS "clhep_set_compiler_flags: Do not know how to set
${
CLHEP_BUILD_CXXSTD
}
extensions for
${
CMAKE_CXX_COMPILER_ID
}
")
endif()
...
...
@@ -203,10 +203,16 @@ macro( clhep_set_compiler_flags )
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "" FORCE)
endif()
# find pthread
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads)
##message(STATUS "clhep_set_compiler_flags debug: CMAKE_CXX_FLAGS:
${
CMAKE_CXX_FLAGS
}
")
message(STATUS "cmake build type is
${
CMAKE_BUILD_TYPE
}
")
_clhep_check_cxxstd
()
message
(
STATUS
"enable c++11 extensions:
${
CMAKE_CXX_FLAGS
}
"
)
_clhep_check_cxxstd()
if(THREADS_HAVE_PTHREAD_ARG)
set( CMAKE_CXX_FLAGS "
${
CMAKE_CXX_FLAGS
}
-pthread" )
endif()
message(STATUS "enable c++11 extensions:
${
CMAKE_CXX_FLAGS
}
")
if( CLHEP_DEBUG_MESSAGES )
message(STATUS "clhep_set_compiler_flags debug: CMAKE_CXX_FLAGS:
${
CMAKE_CXX_FLAGS
}
")
message(STATUS "clhep_set_compiler_flags debug: cmake compilers
${
CMAKE_CXX_COMPILER
}
${
CMAKE_C_COMPILER
}
")
...
...
@@ -229,6 +235,14 @@ macro( clhep_set_compiler_flags )
elseif
(
CMAKE_COMPILER_IS_GNUCXX
)
set
(
CMAKE_CXX_FLAGS
"-O -ansi -pedantic -Wall -D_GNU_SOURCE
${
CMAKE_CXX_FLAGS
}
"
)
endif
()
# linker flags
if
(
${
CMAKE_SYSTEM_NAME
}
MATCHES
"Darwin"
)
set
(
CMAKE_SHARED_LINKER_FLAGS
"
${
CMAKE_SHARED_LINKER_FLAGS
}
-Wl,-undefined,error"
)
else
()
set
(
CMAKE_SHARED_LINKER_FLAGS
"
${
CMAKE_SHARED_LINKER_FLAGS
}
-Wl,--no-undefined"
)
endif
()
message
(
STATUS
"setting CMAKE_SHARED_LINKER_FLAGS
${
CMAKE_SHARED_LINKER_FLAGS
}
"
)
# override flags for Windows cl
if
(
${
CMAKE_SYSTEM_NAME
}
MATCHES
"Windows"
)
##message( STATUS "system is Windows" )
##message( STATUS "CMAKE_BASE_NAME is ${CMAKE_BASE_NAME}" )
...
...
@@ -237,14 +251,9 @@ macro( clhep_set_compiler_flags )
##message( STATUS "incoming basic compiler flags are ${CMAKE_CXX_FLAGS}")
set
(
CMAKE_C_FLAGS
"/EHsc /nologo /GR /MD /D USING_VISUAL"
)
set
(
CMAKE_CXX_FLAGS
"/EHsc /nologo /GR /MD /D USING_VISUAL"
)
set
(
CMAKE_SHARED_LINKER_FLAGS
"/EHsc /nologo /GR /MD /D USING_VISUAL"
)
endif
()
endif
()
# linker flags
if
(
${
CMAKE_SYSTEM_NAME
}
MATCHES
"Darwin"
)
set
(
CMAKE_SHARED_LINKER_FLAGS
"
${
CMAKE_SHARED_LINKER_FLAGS
}
-Wl,-undefined,error"
)
else
()
set
(
CMAKE_SHARED_LINKER_FLAGS
"
${
CMAKE_SHARED_LINKER_FLAGS
}
-Wl,--no-undefined"
)
endif
()
clhep_autoconf_variables
()
message
(
STATUS
"compiling with
${
clhep_cxx_compiler
}
${
CMAKE_CXX_FLAGS
}
${
CXXFLAGS
}
"
)
endmacro
(
clhep_set_compiler_flags
)
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment