Is there anyway in cmake to do something like 'ldd', i.e., given a target, get its linked libraries, and store them in a list?
If there is not, is there a way to do a command line 'ldd' (i know using COMMAND) and store the output to a cmake variable?
Thanks
Well I pretty much get it
include(GetPrerequsites)
and use function
GET_PREREQUISITES
see this: http://www.cmake.org/pipermail/cmake/2009-June/029975.html
Since CMake 3.16, GET_PREREQUISITES is deprecated. Use file(GET_RUNTIME_DEPENDENCIES) instead.
https://cmake.org/cmake/help/latest/command/file.html#get-runtime-dependencies
Related
I am looking at the vim help files and looking for a variable on the linux version that is like v:completed_item from cygwin. v:completed_item is a:
Dictionary containing the complete-items for the most recently completed word after CompleteDone. The Dictionary is empty if the completion failed.
I am looking for the same thing for Linux but I cannot find it and the closes thing I can find in the ins-completion help file is complete-item but nothing on how to use it anyone know how to use it? And if it will be the same as the completed_item from the cygwin version?
Thanks
The presence of a feature doesn't depend on the platform, it depends on the build type, version number, and patch-level.
If you want feature parity between two environments, you rather obviously must install the same build type and version number (including patches) on both environments.
FYI, that variable was added in patch 7.4.774.
I have a rather large component, that is built with GNU autotools. Assuming that the configuration step was already done by somebody (by the build server, in this case), can I somehow find out afterwards, how exactly the ./configure script was called? I mean, with which options?
Thanks, Georg
Ah found it. It's in the beginning of config.log. Was just too simple for me...
It always produce an error that cant find "unistd.h" why? Any remedies for this?
Services for Unix ships with various linux related headers (including unistd.h), so you could use that.
But that might require to link some of the SFU libraries..
Why? It's just not there. It looks like you try to compile a program that is not portable or you try to port the program to Windows.
unistd.h is a not a standard header. Probably you find it only on Unix-like systems.
See: Wiki
See Is there a replacement for unistd.h for Windows (Visual C)? for a partial replacement. (If you can add aditional functionality, please do so).
I have implemented a simple linux shell in c. Now, I am adding some features and one I immediately thought about was to be able to show the last commands with the up arrow.
Question 1:
However, I have no idea how to accomplish this. Do you?
Question 2:
Any comment on how to store the "history" commands are also appreciated. I suppose something like a queue which allows access to all elements would be a good idea. Am I wrong? Do I have to implement it or is there already some good implementation out there I should know about?
Thanks.
Build libedit or readline support into your shell.
If you want to be lazy, you can use rlwrap:
rlwrap prog
I wrote the shell for HelenOS. Grab the bzr repo and navigate to uspace/app/bdsh (bdsh stands for the (b)rain (d)ead (sh)ell).
Other contributors have since added line editing / history / tab completion to the functions that handle input. Its written purely in ANSI C, does not link against glibc and implements its own functions. The code (both in the shell and underlying HelenOS libc) is 3 clause BSD, you can use it in anything.
If nothing else, it might help to just examine the implementation to get started.
I'm trying to write a configure.ac file such that the resulting configure script searches for a library directory containing a given static library e.g. libsomething.a. How can I do this? At the moment I have it check just one location with:
AC_CHECK_FILE([/usr/local/lib/libsomething.a],[AC_SUBST(libsomething,"-L/usr/local/lib -lsomething")],[AC_SUBST(libcfitsio,'')])
But I want it to try and find it automatically. And if the library isn't in one of the default locations, I'd like configure to say that the library wasn't found and that a custom location can be specified with --use-something=path as is usually done. So I also need to then check if --use-something=path is provided. I'm pretty new at creating configure files, and the M4 documentation isn't very easy to follow, so would appreciate any help.
Thanks!
It's not the job of configure to search where libraries are installed. it should only make sure they are available to the linker. If the user installed them in a different location, he knows how to call ./configure CPPFLAGS=-I/the/location/include LDFLAGS=-L/the/location/lib so that the tools will find the library (this is explained in the --help output of configure and in the standard INSTALL file).
Also --with-package and --enable-package macros are not supposed to be used to specify paths, contrary to what many third-party macros will do. The GNU Coding Standards explicitly prohibit this usage:
Do not use a --with option to
specify the file name to use to find
certain files. That is outside the scope
of what --with options are for.
CPPFLAGS and LDFLAGS are already here to address the problem, so why redevelop and maintain another mechanism?
The best way to figure this out is to look at other autoconf macros that do something similar. Autoconf macros are an amalgam of Bourne shell script and M4 code, so they can literally solve any computable problem.
Here's a link to a macro I wrote for MySQL++ that does this: mysql++.m4.