[CMake] Wrong cl.exe getting picked up

2012-03-14 Thread James Bigler
I have a system with several copies of Visual Studio installed.

When I set the generator for "Visual Studio 9 2008" it ends up picking up a
different compiler:

CMAKE_C_COMPILER:FILEPATH=C:/Program Files (x86)/SCE/Common/VSI/bin/cl.exe

I think this is because of the following code in
CMakeDetermineCCompiler.cmake (which I can't figure out how it's invokes by
the cmake-gui or cmake.exe):

  # Find the compiler.
  IF (_CMAKE_USER_CXX_COMPILER_PATH)
FIND_PROGRAM(CMAKE_C_COMPILER NAMES ${CMAKE_C_COMPILER_LIST} PATHS
${_CMAKE_USER_CXX_COMPILER_PATH} DOC "C compiler" NO_DEFAULT_PATH)
  ENDIF (_CMAKE_USER_CXX_COMPILER_PATH)
  FIND_PROGRAM(CMAKE_C_COMPILER NAMES ${CMAKE_C_COMPILER_LIST} DOC "C
compiler")

  IF(CMAKE_C_COMPILER_INIT AND NOT CMAKE_C_COMPILER)
SET(CMAKE_C_COMPILER "${CMAKE_C_COMPILER_INIT}" CACHE FILEPATH "C
compiler" FORCE)
  ENDIF(CMAKE_C_COMPILER_INIT AND NOT CMAKE_C_COMPILER)

I believe the CMAKE_C_COMPILER_LIST contains "cl" as is the default of
CMAKE_GENERATOR_CC for VS generators.

Typically VS isn't in the default path, so the first two FIND_PROGRAM
commands don't yield any usable results.  Then the next block sets the
CMAKE_C_COMPILER to "cl", and everything is OK, because if it's run from
within the project, VS sets the paths so its cl.exe is first.

However if there is another cl.exe in the system PATH, then that version
will get picked up by the second FIND_PROGRAM, and thus cause a bit of
trouble later on when the copies of cl.exe aren't the same.

Does this seem like a bug to anyone?  It seems like if you would want cl to
point to the same version as your copy of Visual Studio.  Perhaps
$(VCInstallDir) could be used with a custom command to generate what VS
thinks the path should be?

Anyone have any thoughts?

I'm using CMake 2.8.2 and 2.8.6 on windows.

James
--

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

Re: [CMake] Ninja + CMake on a dashboard?

2012-03-14 Thread Marcus D. Hanwell
On Fri, Mar 9, 2012 at 12:34 PM, Bill Hoffman  wrote:
> On 3/9/2012 12:21 PM, Steven Wilson wrote:
>>
>> Where does the Ninja generator currently live?   Ie which branch in the
>> sources, etc?   I am keen to see support for the Ninja generator on
>> Mac/Linux/Windows and would not mind working on it.
>>
>> Thanks,
>>
>> Steve
>
> The ninja support is in the next branch right now.  Where is stands:
>
> - Linux seems to be all done
> - Windows is close, still a few failing tests, and needs to use a special
> ninja:
> http://sourceforge.net/projects/cmakescript/files/ninja.exe/download
> - The Mac needs the most work, as Framework and App bundle creation is not
> yet implemented.
>
> I am working on getting nightly dashboards for all three linux, windows and
> Mac going.  I am going to turn on the ninja build by default on linux, and
> have an advanced cache option that will default to off for windows and mac.
>   When the next version comes out it will be enabled on all platforms that
> are passing all the tests (currently only linux).
>
> The topic where the work happens is on the stage, and is called
> stage/ninja-generator.
>
I just tried this out and it is looking good on Linux. I can probably
get a CMake and VTK nightly submission up and running. I will have to
change my default generator once I figure out how I can make this work
with Qt Creator.

Marcus
--

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


Re: [CMake] Passing extra parameters to CTest from a RUN_TESTS visual studio project

2012-03-14 Thread David Cole
Nothing's changed w.r.t. running ctest via the RUN_TESTS project.

You could always add your own custom target if you want to run ctest
with additional arguments.


HTH,
David


On Wed, Mar 14, 2012 at 3:18 PM, Massaro Alessio
 wrote:
> Hi there
>
>
>
> This has been asked before in 2010, but I thought I might check if anything
> has changed in CMake v2.8.7.
>
>
>
> Is it possible to specify extra flags for CTest when it’s invoked by the
> post-build script in a Visual Studio RUN_TESTS project?
>
>
>
> Adding the following to my main CMakeLists.txt, main scope, right before
> enable_testing(), does not work for me.
>
>
>
> Thanks in advance!
>
>
>
>
>
> include(ProcessorCount)
>
> ProcessorCount(NR_OF_CORES)
>
> if(NOT NR_OF_CORES EQUAL 0)
>
>     mb_message(STATUS "Setting CTest to execute ${NR_OF_CORES}
> test modules in parallel")
>
>     set(CTEST_BUILD_FLAGS -j${NR_OF_CORES} -V)
>
> else()
>
>     set(CTEST_BUILD_FLAGS -V)
>
> endif()
>
>
>
> enable_testing()
>
>
> --
>
> 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
--

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


[CMake] Passing extra parameters to CTest from a RUN_TESTS visual studio project

2012-03-14 Thread Massaro Alessio
Hi there

This has been asked before in 2010, but I thought I might check if anything has 
changed in CMake v2.8.7.

Is it possible to specify extra flags for CTest when it's invoked by the 
post-build script in a Visual Studio RUN_TESTS project?

Adding the following to my main CMakeLists.txt, main scope, right before 
enable_testing(), does not work for me.

Thanks in advance!


include(ProcessorCount)
ProcessorCount(NR_OF_CORES)
if(NOT NR_OF_CORES EQUAL 0)
mb_message(STATUS "Setting CTest to execute ${NR_OF_CORES} test 
modules in parallel")
set(CTEST_BUILD_FLAGS -j${NR_OF_CORES} -V)
else()
set(CTEST_BUILD_FLAGS -V)
endif()

enable_testing()
--

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

[CMake] Trying to build Paraview for Visual Studio Express 2010

2012-03-14 Thread Francisco Caraballo
Hello everyone.

I'm using CMAKE to build Paraview with Visual Studio Express 2010. I'm
having a problem with the generated solution. The problem is that one
of the entries generated for included libraries (the MPI libraries)
should be semi colon separated but it is space separated. The result
of this is that the linker generates a lot of errors when building the
project.

This is the problematic entry:
LINK : fatal error LNK1104: cannot open file 'C:\Program Files
(x86)\MPICH2\lib\mpi.lib C:\Program Files (x86)\MPICH2\lib\cxx.lib'

I tried to fix it by changing the included libraries manually project
by project, but it is taking way too long.

How can I solve this? I'm not familiar enough with CMAKE's
architecture to pinpoint what I need to change.

Saludos/greetings,

Francisco Caraballo
--

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


[CMake] how add library?

2012-03-14 Thread Quân Phạm Minh
I want add library (header file + dll file) to my project. How do I do in
cmake?
--

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

[CMake] [PATCH] Correctly generate depfiles when some pre-processor (like distcc or ccache) is used

2012-03-14 Thread Alexander Usov
In pre-processing mode GCC doesn't have target filename and has to guess
target name for depfile.
Use -MT to force correct target name.

gcc -c -MMD -o foo.cc.o foo.cc  => foo.cc.o: 
gcc -E -MMD -o foo.i foo.cc => foo.o: 
gcc -E -MMD -MT foo.cc.o -o foo.i foo.cc => foo.cc.o: 

---
Modules/Compiler/GNU.cmake|2 +-
Source/cmNinjaTargetGenerator.cxx |1 +
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake
index bdcaf9d..2c70806 100644
--- a/Modules/Compiler/GNU.cmake
+++ b/Modules/Compiler/GNU.cmake
@@ -30,7 +30,7 @@ macro(__compiler_gnu lang)
  # in try_compile mode.
  GET_PROPERTY(_IN_TC GLOBAL PROPERTY IN_TRY_COMPILE)
  if(NOT _IN_TC OR CMAKE_FORCE_DEPFILES)
-set(CMAKE_DEPFILE_FLAGS_${lang} "-MMD -MF ")
+set(CMAKE_DEPFILE_FLAGS_${lang} "-MMD -MT  -MF ")
  endif()

  # Initial configuration flags.
diff --git a/Source/cmNinjaTargetGenerator.cxx
b/Source/cmNinjaTargetGenerator.cxx
index 8fa367f..991bf25 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -331,6 +331,7 @@ cmNinjaTargetGenerator
depfile = "$out.d";
cmSystemTools::ReplaceString(depfileFlagsStr, "",
 depfile.c_str());
+cmSystemTools::ReplaceString(depfileFlagsStr, "", "$out");
flags += " " + depfileFlagsStr;
  }
  vars.Flags = flags.c_str();
-- 
1.7.9.4
--

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

Re: [CMake] Ninja generator bug

2012-03-14 Thread Nicolas Desprès
On Wed, Mar 14, 2012 at 11:38 AM, Alexander Usov  wrote:
> Hi,
>
> I'm testing CMake's Ninja generator for our project and have found a bug in 
> it.
> The fix is pretty trivial -- just 2-line change.

You can just attach it to your email if it is short. Use
git-format-patch(1). Or you can use github to submitt a patch series.

>
> What is the correct procedure for submitting it?
> I have looked at the bug tracker, but it seems to only list released
> versions of cmake.
>
> --
> Best regards,
>   Alexander.
> --
>
> 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


[CMake] Ninja generator bug

2012-03-14 Thread Alexander Usov
Hi,

I'm testing CMake's Ninja generator for our project and have found a bug in it.
The fix is pretty trivial -- just 2-line change.

What is the correct procedure for submitting it?
I have looked at the bug tracker, but it seems to only list released
versions of cmake.

-- 
Best regards,
  Alexander.
--

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


[CMake] Linking to binary library with a relative path

2012-03-14 Thread GOO Creations

Hi all,

I have a small problem linking a external library to my project. Here is 
an indication of my directory structure.


root (dir)
 |- external (dir)
 |- external.so (shared library)
 |- mylibs (dir)
 |- 
 |- myprog (executable)

 In the directory "mylibs" all my source code is located. During 
installation all the libraries are also stored in a dir "mylibs" (in the 
install dir).
 I then use Cmake to simply copy "external.so" to the install 
directory. This library is already precompiled (binary). The executable 
is linked to my libraries in the mylibs dir, and one lib in mylibs is 
linked to external.so.


 I use the following statements to link my libs:

ADD_LIBRARY(exter STATIC IMPORTED)
SET_TARGET_PROPERTIES(exter PROPERTIES IMPORTED_LOCATION 
${CMAKE_INSTALL_PREFIX}/external/external.so)

TARGET_LINK_LIBRARIES(mylibx exter)

When I make and install the program, everything works perfectly, but 
mylibx is linked to external.so via a absolute path (eg: 
/home/me/project/install/external/external.so), hence when you rename 
the install folder, the executable will complain that it can't find 
external.so (since the absolute path was changed).

My first thought was to change the following

SET_TARGET_PROPERTIES(exter PROPERTIES IMPORTED_LOCATION 
external/external.so)


Now I have a relative path, but during compilation mylibx throws an 
error that it can't find external.so.
How can I tell Cmake to use the library external.so at a specific path, 
but link mylibx to a relative path?


Thanks for any suggestions.

Christoph

--

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


[CMake] add dll and header to project?

2012-03-14 Thread Quân Phạm Minh
project A depend project B. B is library. I want provide project A header
files of project B and dll files in debug and release mode library of
project B. How I do in cmake?
add_definitions("-DQDisplay_export=__declspec(dllimport)")
link_directories(${CMAKE_SOURCE_DIR}/display/build2008/debug)
include_directories(${CMAKE_SOURCE_DIR}/display)
ADD_EXECUTABLE(${PROJECT_NAME} ${${PROJECT_NAME}_SRCS}
${${PROJECT_NAME}_HDRS} ${${PROJECT_NAME}_MOCS} ${${PROJECT_NAME}_RCC_SRCS})
SET(EXTRA_LIBS ${EXTRA_LIBS} display)

TARGET_LINK_LIBRARIES(${PROJECT_NAME}
${QT_QTCORE_LIBRARY}
${QT_QTGUI_LIBRARY}
${QT_QTSVG_LIBRARY}
display
)
I build successfull but when run meet error:
the procedure entry point display@... could not be located in the dynamic
link library display.dll
--

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

Re: [CMake] how to determine debug or release mode?

2012-03-14 Thread Rolf Eike Beer
Please keep the list in the replies so other people may answer.

> actually, I want build my library in debug and release mode with name in
> debug is mylibd.dll and release mode is mylib.dll. can you help me?

set_target_properties(mylib PROPERTIES DEBUG_POSTFIX "d")

Eike
--

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


Re: [CMake] how to determine debug or release mode?

2012-03-14 Thread Rolf Eike Beer
> how determine build type in cmake like
> if (CMAKE_BUILD_TYPE EQUAL "DEBUG")
> message("debug mode")
> endif (CMAKE_BUILD_TYPE EQUAL "DEBUG")

if (CMAKE_BUILD_TYPE STREQUAL "Debug")
--

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


Re: [CMake] how to determine debug or release mode?

2012-03-14 Thread Dirk vanMeeuwen
IF(CMAKE_BUILD_TYPE MATCHES DEBUG)
message("debug mode")
ENDIF(CMAKE_BUILD_TYPE MATCHES DEBUG)

Kind regards,

Dirk van Meeuwen,
Process Modeling Engineer

Technip Benelux B.V. 
Boerhaavelaan 31, PO Box 86
2700 AB Zoetermeer

direct dial: +31 (0)79 3293 843
direct fax : +31 (0)79 3293 700
direct email: dvanmeeu...@technip.com
internet: www.spyrosuite.com



From:   Quân Phạm Minh 
To: cmake@cmake.org
Date:   03/14/2012 09:19 AM
Subject:[CMake] how to determine debug or release mode?
Sent by:cmake-boun...@cmake.org



how determine build type in cmake like 
if (CMAKE_BUILD_TYPE EQUAL "DEBUG")
message("debug mode")
endif (CMAKE_BUILD_TYPE EQUAL "DEBUG") --

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


 
 
This email and any attached files ("Message") may contain confidential and/or 
privileged information. It is intended solely for the addressee(s). If you 
receive this Message in error, inform the sender by reply email, delete the 
Message and destroy any printed copy.
Any unauthorized use, distribution, or copying of this Message or any part 
thereof is prohibited. Emails are susceptible to alteration. Neither Technip 
nor any of its affiliates shall be liable for the Message if altered or 
falsified nor shall they be liable for any damage caused by any virus that 
might be transmitted with this Message.

--

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

[CMake] how to determine debug or release mode?

2012-03-14 Thread Quân Phạm Minh
how determine build type in cmake like
if (CMAKE_BUILD_TYPE EQUAL "DEBUG")
message("debug mode")
endif (CMAKE_BUILD_TYPE EQUAL "DEBUG")
--

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