Open kwach opened 1 year ago
Also it might be a typo in
macro(check_symbol NAME HEADER)
make_have_identifier(${NAME} HAVE)
configure_define(${HAVE})
cmake_push_check_state()
if(${ARGC} GREATER 1)
string(APPEND CMAKE_REQUIRED_FLAGS " ${ARGV2}") # <--- here
endif()
list(APPEND CMAKE_REQUIRED_DEFINITIONS ${GLOBAL_DEFINITION_FLAGS})
check_symbol_exists(${NAME} ${HEADER} ${HAVE})
cmake_pop_check_state()
endmacro()
Probably should be:
macro(check_symbol NAME HEADER)
make_have_identifier(${NAME} HAVE)
configure_define(${HAVE})
cmake_push_check_state()
if(${ARGC} GREATER 1)
string(APPEND CMAKE_REQUIRED_FLAGS " ${ARGN}")
endif()
list(APPEND CMAKE_REQUIRED_DEFINITIONS ${GLOBAL_DEFINITION_FLAGS})
check_symbol_exists(${NAME} ${HEADER} ${HAVE})
cmake_pop_check_state()
endmacro()
For some reason it contains a project directory and that breaks the check (ld) ARGN is always empty for me, anyway
Hi!
Thus in most cases PROJCET_SOURCE_DIR variable should be used
Thanks, that's very useful to know! I was learning CMake when I wrote all of this so, there might be some quirks!
I'm trying to add libmemcached target in my project by
add_subdirectory(${AWESOMIZED_MEMCACHED_DIR})
Do you really need to include the source directory? I think CMake provides ways to build dep projects, or libmemcached should generate appropriate /usr/lib/cmake files on build/install.
Also it might be a typo in
string(APPEND CMAKE_REQUIRED_FLAGS " ${ARGV2}") # <--- here
No, I don't think so, see https://cmake.org/cmake/help/latest/command/macro.html and https://cmake.org/cmake/help/latest/command/function.html
It is for adding a custom compiler flag if needed to check for a symbol. Apparently it's not used anymore.
The actual bug could be that ARGC
should maybe checked to be greater than 2?
Nevertheless, thanks for your report. I'm open to bug fixes and PRs!
I'm trying to add libmemcached target in my project by
and it seems that it fails to find _Configure:
that is included from
CMake/_Include
like so:I found that this fixes the issue:
And this is how I learned about difference :D
There is a difference between these variables. CMAKE_SOURCE_DIR does indeed refer to the folder where the top-level CMakeLists.txt is defined. However, PROJECT_SOURCE_DIR refers to the folder of the CMakeLists.txt containing the most recent project() command.
Thus in most cases PROJCET_SOURCE_DIR variable should be used