Cache CMAKE_CURRENT_LIST_DIR for correct paths in macros
This commit is contained in:
parent
54f0855312
commit
84bfa4ae2a
@ -1,4 +1,6 @@
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
|
set(_LINK_FLAG_LIST_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||||
|
|
||||||
macro(check_link_flag _variable _flag)
|
macro(check_link_flag _variable _flag)
|
||||||
string (MAKE_C_IDENTIFIER ${_flag} _name)
|
string (MAKE_C_IDENTIFIER ${_flag} _name)
|
||||||
|
|
||||||
@ -12,7 +14,7 @@ macro(check_link_flag _variable _flag)
|
|||||||
__check_link_flag_${_name}
|
__check_link_flag_${_name}
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp"
|
"${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp"
|
||||||
SOURCES
|
SOURCES
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/test_link_flag.cpp")
|
"${_LINK_FLAG_LIST_DIR}/test_link_flag.cpp")
|
||||||
|
|
||||||
if (__check_link_flag_${_name})
|
if (__check_link_flag_${_name})
|
||||||
message (STATUS "checking linker flag ${_flag} - found")
|
message (STATUS "checking linker flag ${_flag} - found")
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
##
|
##
|
||||||
## Does not work for C++ symbols.
|
## Does not work for C++ symbols.
|
||||||
|
|
||||||
|
set(_SEARCH_LIBS_LIST_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||||
macro(search_libs _variable _symbol)
|
macro(search_libs _variable _symbol)
|
||||||
if (NOT DEFINED __search_libs_${_symbol})
|
if (NOT DEFINED __search_libs_${_symbol})
|
||||||
message (STATUS "searching for ${_symbol}")
|
message (STATUS "searching for ${_symbol}")
|
||||||
@ -21,7 +22,7 @@ macro(search_libs _variable _symbol)
|
|||||||
__search_libs_${_symbol}
|
__search_libs_${_symbol}
|
||||||
"${CMAKE_BINARY_DIR}/CMakeTmp"
|
"${CMAKE_BINARY_DIR}/CMakeTmp"
|
||||||
SOURCES
|
SOURCES
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/search_libs.cpp"
|
"${_SEARCH_LIBS_LIST_DIR}/search_libs.cpp"
|
||||||
COMPILE_DEFINITIONS
|
COMPILE_DEFINITIONS
|
||||||
"-DSYMBOL=${_symbol}")
|
"-DSYMBOL=${_symbol}")
|
||||||
|
|
||||||
@ -36,7 +37,7 @@ macro(search_libs _variable _symbol)
|
|||||||
__search_libs_${_symbol}
|
__search_libs_${_symbol}
|
||||||
"${CMAKE_BINARY_DIR}/CMakeTmp"
|
"${CMAKE_BINARY_DIR}/CMakeTmp"
|
||||||
SOURCES
|
SOURCES
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/search_libs.cpp"
|
"${_SEARCH_LIBS_LIST_DIR}/search_libs.cpp"
|
||||||
LINK_LIBRARIES
|
LINK_LIBRARIES
|
||||||
"${lib}"
|
"${lib}"
|
||||||
COMPILE_DEFINITIONS
|
COMPILE_DEFINITIONS
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
set(_TEST_RESTRICT_LIST_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||||
|
|
||||||
macro(test_restrict VARIABLE)
|
macro(test_restrict VARIABLE)
|
||||||
if (NOT DEFINED TEST_${VARIABLE})
|
if (NOT DEFINED TEST_${VARIABLE})
|
||||||
message (STATUS "checking for restrict keyword")
|
message (STATUS "checking for restrict keyword")
|
||||||
@ -6,7 +8,7 @@ macro(test_restrict VARIABLE)
|
|||||||
TRY_COMPILE(
|
TRY_COMPILE(
|
||||||
TEST_${VARIABLE}
|
TEST_${VARIABLE}
|
||||||
"${CMAKE_BINARY_DIR}/CMakeTmp"
|
"${CMAKE_BINARY_DIR}/CMakeTmp"
|
||||||
SOURCES "${CMAKE_CURRENT_LIST_DIR}/test_restrict.cpp"
|
SOURCES "${_TEST_RESTRICT_LIST_DIR}/test_restrict.cpp"
|
||||||
COMPILE_DEFINITIONS "-DKEYWORD=${KEYWORD}")
|
COMPILE_DEFINITIONS "-DKEYWORD=${KEYWORD}")
|
||||||
set(__test_restrict_last ${KEYWORD})
|
set(__test_restrict_last ${KEYWORD})
|
||||||
ENDIF (NOT TEST_${VARIABLE})
|
ENDIF (NOT TEST_${VARIABLE})
|
||||||
|
Loading…
Reference in New Issue
Block a user