Closed code-disaster closed 9 years ago
Good catch. I think fips_libs() is currently kind of redundant, can you check whether fips_deps() works for you (like here: https://github.com/floooh/oryol/blob/master/code/Modules/Gfx/CMakeLists.txt#L144)? I'm wondering if I should actually remove the fips_libs() call.
... I think there's also a bug in fips_end_lib(), this block is missing which is both in fips_end_module() and fips_end_app(): https://github.com/floooh/fips/blob/master/cmake/fips.cmake#L193
You are right, use of fips_deps() works if the missing block is added to fips_end_lib().
Just FYI this triggers a warning if the CMake verbose level is raised:
CMake Warning (dev) at ... (add_dependencies):
Policy CMP0046 is not set: Error on non-existent dependency in
add_dependencies. Run "cmake --help-policy CMP0046" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.
The dependency target "OpenGL32" of target "graphics" does not exist.
This warning is for project developers. Use -Wno-dev to suppress it.
Hmm this warning is a side effect of a fix I had to do for code generation where it must be ensured that a target which depends on another target with code generation is built after that code-generation target. Such a target dependency doesn't make sense for existing static link libs... I'll try setting this cmake_policy in fips_setup.
PS: I will fix this policy warning in a clean way by actually re-using fips_libs() for this. The idea is that fips_deps() is used for depdencies to cmake targets (defined with fips_begin/end_module() and fips_begin/end_lib()), and fips_libs() for precompiled static link libraries (like OpenGL32).
:thumbsup: sounds reasonable
Use fips_libs() now to define dependencies to existing static link libs that are not built by the project, this will be recursively resolved like fips_deps() dependencies, but will avoid the policy warning (see here for an example: https://github.com/floooh/oryol/blob/master/code/Modules/Gfx/CMakeLists.txt#L144
I've been trying to specify link libraries with "fips_libs()" for an external library, e.g. in this particular example, some Windows system libraries.
As far as I can see ${CurLinkLibs} is only evaluated for modules and apps, and reset after every library, module and app. Only libs set for an app seem to be passed to the linker.
For now I'm working with fips_libs() with all required libraries inside fips_begin_app()/fips_end_app().