-
Notifications
You must be signed in to change notification settings - Fork 97
Suggest of reimplementing the CMake support with cmake-server #379
Comments
PS: A detailed documentation can be found here on the official website |
Thank you, I found the information we need by running
I did not find an exit command though. Meson, on the other hand, let us know which executables exist in the project in its generated |
After some additional tests, I find the cmake-server quite slow, even though the build directory has been prepared (both |
Well, cmake does not consider |
For older versions, if you want to get accurate information, there are two choices. One is to iterate through the trees by yourself and extract information form *.cmake files. A second choice is to read from the generated makefile or project. Either way is hard. |
PS: I've just checked out the cmake support for qtcreator and discovered that it implemented both support for legacy versions with codeblock projects and newer versions with cmake server. |
PPS: another possible implementation is by using CMAKE_TOOLCHIAN_FILES # Mark variables as used so cmake doesn't complain about them
mark_as_advanced(CMAKE_TOOLCHAIN_FILE)
function(juci_dump_target_info name)
get_target_property(TGT_SRC ${name} SOURCES)
get_target_property(TGT_TYPE ${name} TYPE)
file(WRITE ${CMAKE_BINARY_DIR}/targets/${name}.txt
"TYPE:${TGT_TYPE}\n"
"NAME:${name}\n"
"SOURCES:${TGT_SRC}\n"
)
endfunction()
function(add_executable name)
_add_executable(${ARGV})
if(NOT _CMAKE_IN_TRY_COMPILE)
juci_dump_target_info(${name})
endif()
endfunction()
function(add_library name type)
_add_library(${ARGV})
if(NOT _CMAKE_IN_TRY_COMPILE)
juci_dump_target_info(${name})
endif()
endfunction() Supply it during configuration via -DCMAKE_TOOLCHAIN_FILE and it will dump target info under the binary directory automatically, generating something like
The information is accurate, but the downside is that users will be troubled if their project need to supply their toolchain file. I am still working on a solution right now. |
I was studying the code of jucipp in resent days and noticed that you are implementing cmake support in a hard way. Since cmake3.7 a official server mode was added to cmake to provide semantic information about CMake code it executes to generate. I consider it a much better way of implementing cmake support.
The text was updated successfully, but these errors were encountered: