nc: set a variable to point to this directory
This commit is contained in:
parent
e46716472a
commit
93b876dee7
@ -12,7 +12,7 @@ macro(check_link_flag _variable _flag)
|
||||
__check_link_flag_${_name}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp"
|
||||
SOURCES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/test_link_flag.cpp")
|
||||
"${NC_CMAKE_BASE}/test_link_flag.cpp")
|
||||
|
||||
if (__check_link_flag_${_name})
|
||||
message (STATUS "checking linker flag ${_flag} - found")
|
||||
|
14
nc.cmake
14
nc.cmake
@ -13,6 +13,20 @@ set (THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package (Threads REQUIRED)
|
||||
link_libraries (Threads::Threads)
|
||||
|
||||
# Set the variable NC_CMAKE_BASE to the root path of this collection of cmake
|
||||
# files so that we can reliably point to soure files contained therein
|
||||
# (eg, the search_lib.cpp tests and friends).
|
||||
foreach (d ${CMAKE_MODULE_PATH})
|
||||
message (STATUS testing nc_cmake_base at "${d}")
|
||||
if (EXISTS "${d}/nc.cmake")
|
||||
set (NC_CMAKE_BASE "${d}")
|
||||
message (STATUS testing nc_cmake_base at "${d} - found")
|
||||
break()
|
||||
else ()
|
||||
message (STATUS testing nc_cmake_base at "${d} - not found")
|
||||
endif ()
|
||||
endforeach()
|
||||
|
||||
include (nc_cxx)
|
||||
include (nc_sanitizer)
|
||||
include (nc_platform)
|
||||
|
@ -21,7 +21,7 @@ macro(search_libs _variable _symbol)
|
||||
__search_libs_${_symbol}
|
||||
"${CMAKE_BINARY_DIR}/CMakeTmp"
|
||||
SOURCES
|
||||
"${CMAKE_SOURCE_DIR}/cmake/search_libs.cpp"
|
||||
"${NC_CMAKE_BASE}/search_libs.cpp"
|
||||
COMPILE_DEFINITIONS
|
||||
"-DSYMBOL=${_symbol}")
|
||||
|
||||
@ -36,7 +36,7 @@ macro(search_libs _variable _symbol)
|
||||
__search_libs_${_symbol}
|
||||
"${CMAKE_BINARY_DIR}/CMakeTmp"
|
||||
SOURCES
|
||||
"${CMAKE_SOURCE_DIR}/cmake/search_libs.cpp"
|
||||
"${NC_CMAKE_BASE}/search_libs.cpp"
|
||||
LINK_LIBRARIES
|
||||
"${lib}"
|
||||
COMPILE_DEFINITIONS
|
||||
|
@ -6,7 +6,7 @@ macro(test_restrict VARIABLE)
|
||||
TRY_COMPILE(
|
||||
TEST_${VARIABLE}
|
||||
"${CMAKE_BINARY_DIR}/CMakeTmp"
|
||||
SOURCES "${CMAKE_SOURCE_DIR}/cmake/test_restrict.cpp"
|
||||
SOURCES "${NC_CMAKE_BASE}/test_restrict.cpp"
|
||||
COMPILE_DEFINITIONS "-DKEYWORD=${KEYWORD}")
|
||||
set(__test_restrict_last ${KEYWORD})
|
||||
ENDIF (NOT TEST_${VARIABLE})
|
||||
|
Loading…
Reference in New Issue
Block a user