On 4/23/16 4:04 PM, Paul Fultz II wrote:
On Apr 23, 2016, at 1:09 PM, Robert Ramey
wrote: I would always set it at configuration `cmake -DBUILD_SHARED_LIBS=On` or in my toolchain file, which would be how I would set your `USE_STATIC` variable as well.
LOL - I use the GUI
But don’t you still need to run cmake first before running the GUI?
No - I just startup the GUI, set the directory of the source and the directory of build. This is one think I really like about CMake. I did run the command line version once 4 years ago though.
b) What is the default? - oh it might depend upon whether "option()" is used somewhere. Instead of providing an answer it just gives you another question.
You are right they don’t make clear what the default value is. The `option()` part is so that the user could set it in cmake-gui or ccmake, which is not the clearest in the documentation either.
c) So it is not clear on its face whether the statement add_library(target_name ....) builds a static or shared library. It depends upon some other "global" variable. That is you cannot know what a statement will do by looking at the statement. Worse yet, the behavior of the statement may depend upon some higher level CMakeLists.txt file that you might not even be aware of.
The idea is that the user would set this(not the library author), so it shouldn’t be set in a CMakeLists.txt file.
This statement is not about the particular CMake variable. It's about the fact that the "language" has many, many builtin ambiguities which make it impossible to know or agree on how to use it.
What ambiguities? Cmake has several variables that the user can set to control how to build a project such as BUILD_SHARED_LIBS, CMAKE_PREFIX_PATH, CMAKE_INSTALL_PATH, CMAKE_CXX_FLAGS, CMAKE_CXX_COMPILER, etc. Cmake utilizes these variables when it builds targets, searches for dependencies, and installs components. These variables are documented as well. Furthermore, cmake is setup so you don’t have to think about these variables or implement the same infrastructure. For example, I can build a library like this:
find_library(FOO_LIBRARY_LIBS foo) add_library(MyLib ${SOURCES}) target_link_libraries(MyLib ${FOO_LIBRARY_LIBS}) install(MyLib DESTINATION lib)
Then users can use cmake variables to build the library shared or static, set the prefix directory to search for the library, set the path where the library will be installed, set the compiler or compiler flags. Plus the above can be crosscompiled as well.
There is one confusion here. THere is one type of person or task - building the library as either shared or static. Then there is the person depending on the library/headers in some other CMake project. My concern has mostly been as a developer creating and testing the library. I haven't really addressed the "user" or consumer. So haven't touched about implementing the "find" functionality for "mylib"
LOL - I'm referring to discussions such as this one. The fact that everytime a question is raised, someone has an answer for some specific scenario. This is deemed to be support that the system is a good one. This the exact wrong conclusion! It seems that it never occurs to anyone that the fact that such a question has to be ask in the first place is an indicator that something is fundamentally wrong with the concept and/or implementation.
Nope, the concept is fine. I think its best to actual learn how the tools are supposed to work instead of fighting the system.
LOL - I don't undertake to fight the system - the "system" actually fights me. Actually, the problem is that people think there's a "system" when there isn't. It's really a grab bag of disjoint features which can be made to work. This can be and actually is useful, but it's a system with limited conceptual integrity. This makes it difficult and unintuitive to extend and apply to anything other than the "example" cases. Attempts to extend the "system" end up layer even more confusion on top of whats already there. This looks like it "solves" problems but just makes thing more opaque, arbitrary and fragile. Quality has to be built in - it can't be added on.
Robert Ramey
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost