Clifford Yapp | 1 Apr 2012 07:42
Picon

CMake 2.8.8-rc1, Ninja generator, and clean target

Trying to run the clean target with the Ninja generator in the latest CMake, I noticed that on targets with version properties set like (say):

set_target_properties(libbu PROPERTIES VERSION 19.0.1 SOVERSION 19)

the ninja -t clean command does not remove the libbu.so.19 link. 

Has anyone else seen this issue?

Cheers,
CY

--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
xiaotian chen | 1 Apr 2012 10:51
Picon

CMake adding libraries for Windows get such error ——LINK : fatal error LNK1104: can not open file “hello.lib”

hi, the project wants to link the dll named hello.dll, and it has a import library named hello.lib.
but when i do the Nmake command, it meet the fatal error,who can tell me what's wrong with it.
thanks a lot!
 
my CMakeLists.txt in Project Dir:
 
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(ANEWHELLO)
ADD_SUBDIRECTORY(src)
 
 CMakeLists.txt in src Dir:
INCLUDE_DIRECTORIES(../../hellouselib/lib)
LINK_DIRECTORIES($ANEWHELLO/lib)
ADD_EXECUTABLE(anewhello main.cpp)
TARGET_LINK_LIBRARIES(anewhello hello)
 
here is the cmake output:
__________________________________________________________________________________
 
D:\Work\Projectcode\Cmake_example\anewhello\build>cmake -G "NMake Makefiles" ..
 
CMake Warning (dev) at src/CMakeLists.txt:2 (LINK_DIRECTORIES):
  This command specifies the relative path
    ../../hellouselib/build/lib
  as a link directory.
  Policy CMP0015 is not set: link_directories() treats paths relative to the
  source dir.  Run "cmake --help-policy CMP0015" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.
This warning is for project developers.  Use -Wno-dev to suppress it.
-- Configuring done
-- Generating done
-- Build files have been written to: D:/Work/Projectcode/Cmake_example/anewhello
/build
D:\Work\Projectcode\Cmake_example\anewhello\build>cmake -G "NMake Makefiles" ..
CMake Warning (dev) at src/CMakeLists.txt:2 (LINK_DIRECTORIES):
  This command specifies the relative path
    $ANEWHELLO/lib
  as a link directory.
  Policy CMP0015 is not set: link_directories() treats paths relative to the
  source dir.  Run "cmake --help-policy CMP0015" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.
This warning is for project developers.  Use -Wno-dev to suppress it.
-- Configuring done
-- Generating done
-- Build files have been written to: D:/Work/Projectcode/Cmake_example/anewhello
/build
 
here is the Nmake output:
 
Linking CXX executable anewhello.exe
LINK : fatal error LNK1104: 无法打开文件“hello.lib”
LINK Pass 1 failed. with 2
NMAKE : fatal error U1077: “"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe"”:
 return code “0xffffffff”
Stop.
NMAKE : fatal error U1077: “"d:\Program Files (x86)\Microsoft Visual Studio 9.0
\VC\BIN\nmake.exe"”: return code “0x2”
Stop.
NMAKE : fatal error U1077: “"d:\Program Files (x86)\Microsoft Visual Studio 9.0
\VC\BIN\nmake.exe"”: return code “0x2”
Stop.
 
 
--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Nicolas Desprès | 2 Apr 2012 14:21
Picon
Gravatar

Re: CMake 2.8.8-rc1, Ninja generator, and clean target

Hi,

It looks like an issue in the generator. The symlink is created as a
side effect of a rule and not mentioned in the output files. That's
why it does not get removed. I have pushed a patch on my CMake's
github clone that should fix the issue without breaking cmake's test
suite. Although it seems to works for your case, I'm not sure it is
the right way to fix this issue. I think you should open a ticket on
the bug tracker.

The branch: https://github.com/polrop/CMake/commits/ninja-clean-lib-symlink
The patch: https://github.com/polrop/CMake/commit/7d9c4bec56e8ec34ac715a4e4bda0f0f55002ef0

Peter could you review it please?

Thanks,
-Nico

On Sun, Apr 1, 2012 at 7:42 AM, Clifford Yapp <cliffyapp@...> wrote:
> Trying to run the clean target with the Ninja generator in the latest CMake,
> I noticed that on targets with version properties set like (say):
>
> set_target_properties(libbu PROPERTIES VERSION 19.0.1 SOVERSION 19)
>
> the ninja -t clean command does not remove the libbu.so.19 link.
>
> Has anyone else seen this issue?
>
> Cheers,
> CY
>
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake

--

-- 
Nicolas Desprès
--

Powered by www.kitware.com

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

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

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

Christoph Anton Mitterer | 3 Apr 2012 03:18
Gravatar

portable way for specifying whether everything or selective libs should be linked statically or as shared objects?

Hi.

I started to switch over all my build systems to CMake recently and am
stuck with the following.

I thought of the "C" in CMake ("cross-platform") that it means to that
most basic tasks are handled for most platforms/compilers in a
transparent way, but this seems all but be the case unfortunately.

This starts with commands like add_definitions where one have to use
"-D" as parameter suffix (well eventually there could be compilers which
don't use -D as option for this)... and ends with the following what I
though would really be one of the basics in business.

I'd like to allow users of my build system to specify whether
- everything shall be linked statically (i.e. what gcc's --static does)
- selectively select libraries (for which I allow it) to be linked
statically as shared objects or to be dynamically loaded[0].

Isn't this possible? If it is how?

I mean I've googled obviously and found ugly looking hacks where you set
some magic variables to --static (e.g.)... but this is then absolutely
importable.

Rather I'd have expected some clean interface e.g.
target_link_libraries(foo STATIC lib1 lib2 SHARED lib3 lib4)
where obviously lib1/2 are linked statically and 3/4 as shared objects.

Any ideas?! :-)

Thanks,
Chris.

[0] Obviously handling dynamic loading is out of the scope of CMake, so
the only thing I want here is to set some defines in order to let my
code know that it should dlopen/etc.
Attachment (smime.p7s): application/x-pkcs7-signature, 5677 bytes
--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Bill Hoffman | 3 Apr 2012 03:57
Favicon
Gravatar

Re: portable way for specifying whether everything or selective libs should be linked statically or as shared objects?

On 4/2/2012 9:18 PM, Christoph Anton Mitterer wrote:
> Hi.
>
> I started to switch over all my build systems to CMake recently and am
> stuck with the following.
>
> I thought of the "C" in CMake ("cross-platform") that it means to that
> most basic tasks are handled for most platforms/compilers in a
> transparent way, but this seems all but be the case unfortunately.
Nothing is perfect.  :)
>
> This starts with commands like add_definitions where one have to use
> "-D" as parameter suffix (well eventually there could be compilers which
> don't use -D as option for this)... and ends with the following what I
> though would really be one of the basics in business.
I was concern about this for a while, however, we have never seen a 
compiler that did not take -D.  :)   Actually, I ported to a VMS 
compiler once and it used a different flag, but I was able to fix it 
from the CMake source level, translating the -D to the correct flag for 
that compiler.  So, -D is not really an issue, as CMake can correct for 
it if need be.   The CMake api for definitions is -D.
>
> I'd like to allow users of my build system to specify whether
> - everything shall be linked statically (i.e. what gcc's --static does)
> - selectively select libraries (for which I allow it) to be linked
> statically as shared objects or to be dynamically loaded[0].
>
> Isn't this possible? If it is how?
>
> I mean I've googled obviously and found ugly looking hacks where you set
> some magic variables to --static (e.g.)... but this is then absolutely
> importable.
>
> Rather I'd have expected some clean interface e.g.
> target_link_libraries(foo STATIC lib1 lib2 SHARED lib3 lib4)
> where obviously lib1/2 are linked statically and 3/4 as shared objects.

That would be nice, and has been on the todo list for a while.  However, 
it has never been important enough for someone to actually implement.
>
>
> Any ideas?! :-)
Well, you could implement it... :)

This is an interesting interface:
target_link_libraries(foo STATIC lib1 lib2 SHARED lib3 lib4)

I would suggest that you move to the discussion to the cmake-developers 
list.

-Bill

--

Powered by www.kitware.com

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

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

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

Matt Lamont | 3 Apr 2012 04:07

2.8.8-rc1 CXX compiler id

Hi,

There appears to be a difference in what C++ compiler is detected on OS X, depending on what generator is selected.

Xcode generator:

-- The C compiler identification is GNU 4.2.1
-- The CXX compiler identification is GNU 4.2.1

Makefiles generator:

-- The C compiler identification is GNU 4.2.1
-- The CXX compiler identification is Clang 3.1.0

This 'breaks' a number of open source projects (BZip2 and Assimp are two examples I have encountered), as
this piece of code seems to be common:

if (CMAKE_COMPILER_IS_GNUCXX)
  set ( CMAKE_C_FLAGS     "${CMAKE_C_FLAGS} -fpic")
  set ( CMAKE_CXX_FLAGS   "${CMAKE_CXX_FLAGS} -fpic")
endif (CMAKE_COMPILER_IS_GNUCXX)

For now, i've been adding "OR APPLE" to the if condition, although I'm not sure if that's the right approach.
Is Clang still considered to be "gcc compatible"?

-Matt. 
--

Powered by www.kitware.com

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

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

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

Theodore Papadopoulo | 3 Apr 2012 07:48
Picon
Picon
Favicon

Adding actions on test succes/failure


	Hello,

is there a way to add actions depending on test/succes failure. I have
the following use case.

A first test generates a file.
Then this file is tested with various other tests.
Each read test verifies the output and then remove the files ir generated.

Now I would like to clean generated by the first test if all read
tests passed, so that the test directory at the end pf a full test
contains only the generated files that correspond to test failures
(there are hundreds of such group of tests). In this way, checking
what went wrong is much easier.

I know I can group the tests in one cmake script that will do the job,
but that:

1) that would mean passing a lot of parameters to this cmake script
(the parameters for all the individual tests).
2) thet severely destroys the modularity of tests and will make
analyzing a failure much more complicated.

Thus the question, is there a way to insert an action (eventually a
dummy test but ideally just a cleanup that would not appear as a test)
depending on the result of a group of test (eg in my case if all the
tests of that group succeeded then clean the files they generated).

Currently I do not see any way of doing this, but I may be missing sthg.

Thank's for any insight with this problem.

	Theo
Pascal Bach | 3 Apr 2012 08:46
Picon
Gravatar

Add JavaScript and HTML files to project

Hello

I was looking for a way to add additional non C/C++ files to my
Eclipse project. I found some discussions about this on the web but no
definitive answer.

I'm working on a hybrid application that has some C++ code as well as
a GUI written in JavaScript and HTML.
My setup is a follows: I have a source directory containing all the
C++ code, in the CMakeLists.txt of that directory I added another
directory using add_subdirectory this contains all the HTML/JS code.
However this directory is not a "subdirectory" of the source tree.

Is there a way to make these files appear in eclipse project too?

Thanks for your help

Regards
Pascal
--

Powered by www.kitware.com

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

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

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

Sergio Vera | 3 Apr 2012 10:28
Gravatar

CMAKE_RC_COMPILER

Hello, 

When I compile my own projects with MinGW32 Cmake always complains that it cannot find CMAKE_RC_COMPILER (windres.exe), however, other executables from the Mingw directories are correctly detected.
I've noticed that when compiling VTK5.8.0 with MinGW32, cmake does not compain about the RC compiler. 

Anyone knows how can I resolve the issue with the RC_COMPILER?

Thanks

--
Sergio Vera

 Alma IT Systems
 C/ Vilana, 4B, 4º 1ª
 08022 Barcelona
 T. (+34) 932 380 592
 www.alma3d.com
--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Gregor Jasny | 3 Apr 2012 11:33
Gravatar

How to declare a text file as CMakeLists.txt dependency

Hello,

In my root project CMakeLists.txt file I'm using the file(STRINGS ...) 
command to read some version numbers from a text file. Now I'd like to 
declare this text file as a CMakeLists.txt dependency to re-trigger the 
CMake configuration step if a version number changes (Just like 
re-configuration is triggered if I touch any CMakeLists.txt file).

Is there an easy way to accomplish this?

Thanks,
Gregor
--

Powered by www.kitware.com

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

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

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


Gmane