Re: [CMake] FindMPI & policy CMP0004

2018-03-12 Thread Andreas Naumann
Thank you for the hint, and I run in a similiar problem. Building from 
scratch solved the issue.


Sorry for the noise.

Am 11.03.2018 um 23:07 schrieb Craig Scott:
This could be a case of needing to clear out an old CMake cache. That 
problem you mentioned was supposed to have been fixed already. You can 
find the updated discussion of the Mantis issue you linked to in 
gitlab here 
 where someone 
else had a situation that sounds similar to yours.



On Mon, Mar 12, 2018 at 7:16 AM, Andreas Naumann 
mailto:andreas-naum...@gmx.net>> wrote:


Dear all,

recently, I got a problem with FindMPI on our HPC systems. With
cmake 3.10.2, I get an error about policy CMP0004. And I cannot
set it to OLD anymore. Is this intended?

Exactly the same error, together with a patch, is described in the
bugtracker https://public.kitware.com/Bug/view.php?id=11881


I cannot reproduce the error easiliy. On my home system, it works.
But on the hpc system, mpicc -showme:link returns
-L/lib -lmpi -ldl -lm -lnuma -Wl,--export-dynamic -lrt
-lnsl -lutil -lm -ldl

so, we have exactly one -Wl, part and libraries
otherwise. It looks to me, that the patch from the bugtracker
should avoid the problem.
Can somebody confirm this finding?

The problem gets even worse with newercmake versions. With cmake
3.9, I can set policy cmp0004 to OLD, so FindMPI remains usable.
With newer cmake versions, ie. 3.10.2,  the policy setting seems
to get deprecated. So, the user won't get any way to use newer
cmake with such a bug.

What is the preferred way to resolve such an issue, when the
policy setting is not allowed anymore?

Regards,
Andreas
-- 


Powered by www.kitware.com 

Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ


Kitware offers various services to support the CMake community.
For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html

CMake Consulting: http://cmake.org/cmake/help/consulting.html

CMake Training Courses: http://cmake.org/cmake/help/training.html


Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html


Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake





--
Craig Scott
Melbourne, Australia
https://crascit.com


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] cmake thinks mingw-64 gfortran on Windows is broken

2018-03-12 Thread Brad King
On 03/09/2018 07:58 PM, Ondřej Čertík wrote:
> How do I make CMake pass the "Check for working Fortran compiler" phase?

The problem reported in issue 17810 is caused by trying to
enable C with MSVC and Fortran with GNU together at the same
time, e.g. `project(MyProj C Fortran)`.  These tools cannot
be used together directly.

The purpose of cmake_add_fortran_subdirectory as described
in the blog post is to avoid enabling Fortran in the main
project.  Instead Fortran is only enabled in a separate project
by itself, and the main project gets only C (and CXX).

If you want to use MSVC and Fortran together directly then you
need a Fortran compiler that works with the MSVC binutils.  The
Intel Fortran compiler for Windows, a commercial tool, is one
option.  There is also https://github.com/flang-compiler/flang,
which is currently maturing.

Alternatively you can use GNU from MinGW for all languages,
e.g. `CC=gcc CXX=g++ FC=gfortran cmake ../src`.

-Brad
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


[CMake] Bitcode and CMake

2018-03-12 Thread Cameron Palmer
I’m building frameworks for iOS/tvOS with bitcode at the command-line. In order 
to compile and link I need to add two things:

target_compile_options( library PUBLIC -fembed-bitcode )
target_link_libraries( library PUBLIC -fembed-bitcode )

This works, but yields the complaint that:

ld: warning: -headerpad_max_install_names is ignored when used with 
-bitcode_bundle (Xcode setting ENABLE_BITCODE=YES)

Is there a cleaner way to do this, or do I need to hammer header 
pad_max_install_names in CMAKE_CXX_LINK_FLAGS?
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


[CMake] Cmake Frameworks and Bitcode

2018-03-12 Thread Cameron Palmer
So after a bit of hacking it seems that Cmake should provide something like:

CMAKE_OSX_BITCODE_ENABLE

Which would pass -fembed-bitcode to the compiler and linker and remove the 
option in Darwin.cmake for -Wl,-headerpad_max_install_names in 
CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS.

Does this sound like something that should be submitted as a patch?
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


[CMake] How to obtain a list of target dependencies

2018-03-12 Thread Robert Dailey
Sometimes I need to manually take action on the dependencies of my
targets. Without keeping track of the dependencies externally using
global or custom target properties, is there a way to obtain the list
of targets that a target depends on? This would be the same list of
targets passed to `target_link_libraries()`. For bonus points I'd like
a flattened list of transitive dependencies, to avoid recursively
building this list myself.
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] How to obtain a list of target dependencies

2018-03-12 Thread Robert Dailey
I'm going to add the CMake Dev group as well, since I asked this same
question last year around May and I didn't get any response. Hoping
for some help this time around. I don't see anything documented, so
maybe the developers know the best approach here.

On Mon, Mar 12, 2018 at 3:03 PM, Robert Dailey  wrote:
> Sometimes I need to manually take action on the dependencies of my
> targets. Without keeping track of the dependencies externally using
> global or custom target properties, is there a way to obtain the list
> of targets that a target depends on? This would be the same list of
> targets passed to `target_link_libraries()`. For bonus points I'd like
> a flattened list of transitive dependencies, to avoid recursively
> building this list myself.
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] [cmake-developers] How to obtain a list of target dependencies

2018-03-12 Thread Ben Boeckel
On Mon, Mar 12, 2018 at 15:11:28 -0500, Robert Dailey wrote:
> I'm going to add the CMake Dev group as well, since I asked this same
> question last year around May and I didn't get any response. Hoping
> for some help this time around. I don't see anything documented, so
> maybe the developers know the best approach here.

There's an issue for this here:

https://gitlab.kitware.com/cmake/cmake/issues/12435

There has been extensive discussion on the feature and previous mailing
list threads about it. I'm not intimately familiar with that discussion
myself, but it has more details at least.

--Ben
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


[CMake] Cannot build sub-directory library if top-level CMakeLists.txt call install(EXPORT ...)

2018-03-12 Thread Ziji Hu
Hi all,

I'm a newbie of CMake. I'm trying to add a feature as a sub-library to
an existing application. But I met troubles of install(EXPORT ...)

My project source code structure shows as below:
app (the existing application)
 |-- top-level CMakeLists.txt
 |
 |-- sublib (my new feature)
 ||-- src
 ||-- include
 ||-- CMakeLists.txt
 |
 |-- other existing src ...

I build sublib in the CMakeLists.txt inside my own feature as:
 ...
 add_library(sublib ${LIB_SRC})
 ...

I modify the top-level CMakeLists.txt in the existing application to
link sublib:
 ...
 add_subdirectory(subdirectory of sublib)
 ...
 target_link_directories(app sublib)
 ...

I thought it is enough. But CMake threw out an error:
CMake Error: install(EXPORT "appTargets" ...) includes target "app"
which requires target "sublib" that is not in the export set.

I guess it is because "app" is exported by install(EXPORT .. ) in the
top-level CMakeLists.txt. Thus I also install and export sublib.
I add the install and export into sublib CMakeLists.txt:
...
install(TARGETS sublib
EXPORT  sublibTargets
ARCHIVE DESTINATION ${BIN_INSTALL_DIR}
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
RUNTIME DESTINATION ${LIB_INSTALL_DIR}
)

install(EXPORT sublibTargets
FILE sublib-config.cmake
DESTINATION ${LIB_INSTALL_DIR}/cmake/sublib
)
...
I also add find_package() in top-level CMakeLists.txt:
...
find_package(sublib REQUIRED)
target_link_directories(app sublib)
...

However, it becomes worse. sublib is not built at all and
sublib-config.cmake is not found.

Could you please tell me how fix the EXPORT issue?

Thank you.

Best regards,
David Hu
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake