[CMake] How to specify build output directory path?

2019-11-13 Thread David Aldrich
Hi

I am rather confused about how to specify the output directory. I am
working on Windows with the Ninja generator and Microsoft toolset. My
default build type is Debug.  I am building a library and an executable:

add_subdirectory(../Kernel Kernel)
add_executable(MyExe ../Kernel/main.cpp)

The resulting directory structure, after a build, is:

Kernel   <== source files
|--CMakeLists.txt
CMake
|--CMakeLists.txt
|-- build_msvc
|--Kernel  <== library goes here
|--debug  <==  exe goes here

I want the Kernel library to go into the 'debug' folder (where the exe is
correctly being put).

$CMAKE_RUNTIME_OUTPUT_DIRECTORY and  $RUNTIME_OUTPUT_DIRECTORY are
undefined.

How would I achieve this?

Which variable holds the exe output path: build_msvc/debug?

Best regards
David
-- 

Powered by kitware.com/cmake

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

Visit other Kitware open-source projects at https://www.kitware.com/platforms

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

This mailing list is deprecated in favor of https://discourse.cmake.org


Re: [CMake] Windows C++ static library fails to access external method during initialization

2019-11-08 Thread David Aldrich
Fixed using OBJECT libraries. Thank you to anyone here who answered on
StackOverflow.

On Fri, Nov 8, 2019 at 12:02 PM David Aldrich 
wrote:

> Hi, I have a linker problem with a Windows C++ project that uses a static
> library. I have described the problem on StackOverflow here:
>
>
> https://stackoverflow.com/questions/58765494/windows-c-static-library-fails-to-access-external-method-during-initialization
>
>
> I think the problem could be resolved by adjusting the CMakeLists.txt
> file.  Please could someone have a look at the above link and comment
> either in StackOverflow or reply here?
>
> I am using Ninja with the VS2019 C++ compiler on Windows 10.
>
> Thanks in advance,
> David
>
-- 

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] Windows C++ static library fails to access external method during initialization

2019-11-08 Thread David Aldrich
Hi, I have a linker problem with a Windows C++ project that uses a static
library. I have described the problem on StackOverflow here:

https://stackoverflow.com/questions/58765494/windows-c-static-library-fails-to-access-external-method-during-initialization


I think the problem could be resolved by adjusting the CMakeLists.txt
file.  Please could someone have a look at the above link and comment
either in StackOverflow or reply here?

I am using Ninja with the VS2019 C++ compiler on Windows 10.

Thanks in advance,
David
-- 

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] Using generator expression with add_library

2019-11-07 Thread David Aldrich
Thank you. So I guess I can make it as simple as:

if(MSVC)
add_library(${_star_lib_name} STATIC "")
else()
add_library(${_star_lib_name} SHARED "")
endif()

I just wondered if there was a more elegant way.

On Thu, Nov 7, 2019 at 11:45 AM Petr Kmoch  wrote:

> Hi.
>
> The argument STATIC or SHARED is processed at CMake configure time (that
> is, when CMake is executing the add_library() command). However, generator
> expressions are only evaluated at generate time, which comes only after all
> CMake code is processed.
>
> Fortunately for you, compiler ID is something that is already known at
> configure time, meaning you don't need to use a genex to read it. You can
> just do this:
>
> if(MSVC)
>   set(LibType STATIC)
> else()
>   set(LibType SHARED)
> endif()
> add_library(
>   ${_star_lib_name}
>   ${LibType}
>   ...
> )
>
> (Feel free to modify the if(), use CMAKE__COMPILER_ID (
> https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_ID.html)
> etc. as necessary).
>
> Petr
>
> On Thu, 7 Nov 2019 at 12:28, David Aldrich 
> wrote:
>
>> I want to build a shared library for Linux and a static library for
>> Windows. So I have tried:
>>
>>  set (_star_lib_name "StdStars")
>>
>>  add_library(${_star_lib_name}
>>  $<$:SHARED>
>>  $<$:STATIC>
>>  ""
>>  )
>>
>> but that gives me error:
>>
>> CMake Error at 
>> C:/SVNProj/zodiac/branches/TRY_TML_CMake_3Oct2019/StarLibs/StdStars/CMakeLists.txt:7
>>  (add_library):
>> Cannot find source file:
>>
>> STATIC
>>
>>   Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
>>   .hpp .hxx .in .txx
>>
>> What is the correct way of doing this please?
>> --
>>
>> 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
>>
>
-- 

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] Using generator expression with add_library

2019-11-07 Thread David Aldrich
I want to build a shared library for Linux and a static library for
Windows. So I have tried:

 set (_star_lib_name "StdStars")

 add_library(${_star_lib_name}
 $<$:SHARED>
 $<$:STATIC>
 ""
 )

but that gives me error:

CMake Error at 
C:/SVNProj/zodiac/branches/TRY_TML_CMake_3Oct2019/StarLibs/StdStars/CMakeLists.txt:7
(add_library):
Cannot find source file:

STATIC

  Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
  .hpp .hxx .in .txx

What is the correct way of doing this please?
-- 

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] Fwd: Help needed with '-whole-archive,-export-dynamic'

2019-10-22 Thread David Aldrich
Just to say, I have fixed this problem, so no help needed now.
-- 

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] Help needed with '-whole-archive,-export-dynamic'

2019-10-22 Thread David Aldrich
Hi

I am porting a gnu make project to CMake. Initially I am using the Ninja
generator and running in Ubuntu 18.04.

The project consists of a static library 'libKernel.a', which includes
main.cpp,
which we link into an executable: 'MyApp'. The program dynamically loads
shared
libraries that need objects from 'libKernel.a' so we use options such as
-whole-archive and -export-dynamic.

The original link command for the program is:

g++ -o _gnuRelease/MyApp -Wl,-whole-archive,-export-dynamic,--no-as-needed
../Kernel/_gnuRelease/libKernel.a -Wl,--as-needed,--no-whole-archive
-lpthread -ldl

In CMake I have implemented this as:

add_executable(MyApp ../Kernel/main.cpp)
set_target_properties(MyApp PROPERTIES ENABLE_EXPORTS TRUE)
target_link_libraries(MyApp Kernel ${CMAKE_DL_LIBS})

and CMake's link command is:

/usr/bin/c++  -O3 -DNDEBUG  -Wl,--export-dynamic -rdynamic
CMakeFiles/MyApp.dir/Kernel/main.cpp.o  -o release/MyApp
 Kernel/libKernel.a -ldl

The CMake build is failing to link at runtime as some symbols are missing.

I have two issues here:

1) In the CMake implementation I removed main.cpp from libKernel and
specified
it as the executable source file, as it seems that the executable needs at
least one SOURCE file.  Is there a way around this?

2) How can I tell CMake to use the
'-Wl,-whole-archive,-export-dynamic,--no-as-needed' flags?

Best regards

David
-- 

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 properly add include directories?

2019-10-21 Thread David Aldrich
>
> >What generator are you using?
>

Ninja


> That thread seems to contain a lot of misunderstandings about the issue.
>
> If you are using the Makefile generator then refer to
> https://stackoverflow.com/questions/7461000/handling-header-files-dependencies-with-cmake.
> After building the project for the first time inspect the depend.make
> files that are generated to verify if the headers are being picked up
> correctly as a dependency.
>

Thanks, I made a mistake and was touching the wrong header file. Sorry
about that. Dependencies are correctly generated and working. There seems
to be no need to add the header files to the list of sources.

BTW It seems that dependencies for header files in the same path as the
sources are generated implicitly. Is that expected?

Thanks for your help.

>
>
-- 

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 properly add include directories?

2019-10-21 Thread David Aldrich
Hi again,

My CMakeLists.txt file for my shared library contains:

add_library(MyLib SHARED my_source.cpp etc.)
target_include_directories( MyLib PRIVATE ../MyHeaders)

The library builds ok, but there is no dependency on directory ../MyHeaders
- touching a header file does not result in a re-compile of dependent
source files.

There's a discussion here:

https://stackoverflow.com/questions/13703647/how-to-properly-add-include-directories-with-cmake

Opinion seems divided over whether or not it is necessary to add the header
files to the list of source files for the target, e.g.:

set(SOURCES file.cpp file2.cpp ${YOUR_DIRECTORY}/file1.h
${YOUR_DIRECTORY}/file2.h)
add_library(test ${SOURCES})

Please will you tell me what is the best practice?
-- 

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] Concerning ninja -v

2019-10-21 Thread David Aldrich
>
> >Does just invoking ninja with -v not show verbosity? That should do it.
> > don't believe CMAKE_VERBOSE_MAKEFILE affects Ninja builds.
>
> >Kyle
>

Yes thanks, that does do it. I just wondered whether there was a neater way
for when CMake is invoked by an IDE such as VS Code with the cmake-tools
extension. But it seems that I can specify option '-v' to that tool too.
-- 

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] Concerning ninja -v

2019-10-21 Thread David Aldrich
I have a simple CMake project with subdirectories:

cmake_minimum_required(VERSION 3.10)
project(MyProject VERSION 1.0.0)

set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "ON")

add_subdirectory(say-hello)
add_subdirectory(hello-exe)

Will the 'CMAKE_VERBOSE_MAKEFILE' option be inherited by the CMakeLists.txt
files in the subdirectories?

I want to run ninja with the '-v' option for verbosity but the above 'set'
command is not achieving this. What do I need to do differently?

(I am running CMake 3.15.4 on WSL - Ubuntu 18.04).
-- 

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] Help request for hierarchical directory example

2019-10-18 Thread David Aldrich
Hi Eric

Thanks very much for your answer. I understand now.

David

On Fri, Oct 18, 2019 at 12:57 PM Eric Noulard 
wrote:

>
>
> Le ven. 18 oct. 2019 à 12:53, David Aldrich 
> a écrit :
>
>> Hi
>>
>>
>>
>> I'm learning how to use hierarchical directories in CMake and am trying
>> to get an example to work that I saw on YouTube. The example isn't doing
>> what I expect so I would be grateful for some help in understanding why.
>>
>>
>>
>> I am running CMake 3.10.2 on Ubuntu 18.04 (Microsoft WSL) and using make.
>>
>>
>>
>> I have a project called 'cmake-good' that should build library
>> 'libsay-hello.a' and executable 'cmake-good'.
>>
>>
>>
>> Here's the directory tree (excluding CMake artifacts which I don't think
>> I need to show):
>>
>>
>>
>> ├── CMakeLists.txt
>>
>> ├── build
>>
>> │   ├── CMakeCache.txt
>>
>> │   ├── CMakeFiles
>>
>> │   ├── Makefile
>>
>> │   ├── cmake_install.cmake
>>
>> │   ├── hello-exe
>>
>> │   │   ├── Makefile
>>
>> │   │   ├── cmake-good
>>
>> │   └── say-hello
>>
>> │   ├── Makefile
>>
>> │   └── libsay-hello.a
>>
>> ├── hello-exe
>>
>> │   ├── CMakeLists.txt
>>
>> │   └── main.cpp
>>
>> ├── say-hello
>>
>> ├── CMakeLists.txt
>>
>> └── src
>>
>> └── say-hello
>>
>> ├── hello.cpp
>>
>> └── hello.hpp
>>
>>
>>
>> Here are the CMakeLists.txt files:
>>
>>
>>
>> 1) Top level CMakeLists.txt:
>>
>>
>>
>> cmake_minimum_required(VERSION 3.10)
>>
>> project(MyProject VERSION 1.0.0)
>>
>> add_subdirectory(say-hello)
>>
>> add_subdirectory(hello-exe)
>>
>>
>>
>> 2) hello_exe/CMakeLists.txt:
>>
>>
>>
>> add_executable(cmake-good main.cpp )
>>
>> target_link_libraries(cmake-good PRIVATE say-hello)
>>
>>
>>
>> 3) say-hello/CMakeLists.txt:
>>
>>
>>
>> add_library(
>>
>> say-hello
>>
>> src/say-hello/hello.hpp
>>
>> src/say-hello/hello.cpp
>>
>> )
>>
>> target_include_directories(say-hello PUBLIC
>> "${CMAKE_CURRENT_SOURCE_DIR}/src")
>>
>>
>>
>> My problem is that I expect to see:
>>
>>
>>
>> hello-exe/cmake-good
>>
>> say-hello/libsay-hello.a
>>
>>
>>
>> but I see:
>>
>>
>>
>> build\hello-exe\cmake-good
>>
>> build\say-hello\libsay-hello.a
>>
>>
>>
>> Why is that?
>>
>
> Because build/ is your build directory and you apparently did an
> out-of-source build (which is good practice)
> see :
> https://gitlab.kitware.com/cmake/community/wikis/FAQ#out-of-source-build-trees
>
> You should have done something like:
>
> cd cmake-good/build
> cmake ..
> make
>
> In this case everything the build is generating (CMake artefact, build
> artefact etc...) gets written build/
> the directory hierarchy in build will have the same structure as your
> source tree.
>
> This is an expected behaviour.
>
>
>
> --
> Eric
>
-- 

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] Help request for hierarchical directory example

2019-10-18 Thread David Aldrich
Hi



I'm learning how to use hierarchical directories in CMake and am trying to
get an example to work that I saw on YouTube. The example isn't doing what
I expect so I would be grateful for some help in understanding why.



I am running CMake 3.10.2 on Ubuntu 18.04 (Microsoft WSL) and using make.



I have a project called 'cmake-good' that should build library
'libsay-hello.a' and executable 'cmake-good'.



Here's the directory tree (excluding CMake artifacts which I don't think I
need to show):



├── CMakeLists.txt

├── build

│   ├── CMakeCache.txt

│   ├── CMakeFiles

│   ├── Makefile

│   ├── cmake_install.cmake

│   ├── hello-exe

│   │   ├── Makefile

│   │   ├── cmake-good

│   └── say-hello

│   ├── Makefile

│   └── libsay-hello.a

├── hello-exe

│   ├── CMakeLists.txt

│   └── main.cpp

├── say-hello

├── CMakeLists.txt

└── src

└── say-hello

├── hello.cpp

└── hello.hpp



Here are the CMakeLists.txt files:



1) Top level CMakeLists.txt:



cmake_minimum_required(VERSION 3.10)

project(MyProject VERSION 1.0.0)

add_subdirectory(say-hello)

add_subdirectory(hello-exe)



2) hello_exe/CMakeLists.txt:



add_executable(cmake-good main.cpp )

target_link_libraries(cmake-good PRIVATE say-hello)



3) say-hello/CMakeLists.txt:



add_library(

say-hello

src/say-hello/hello.hpp

src/say-hello/hello.cpp

)

target_include_directories(say-hello PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}/src")



My problem is that I expect to see:



hello-exe/cmake-good

say-hello/libsay-hello.a



but I see:



build\hello-exe\cmake-good

build\say-hello\libsay-hello.a



Why is that?
-- 

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 make a hierarchical application using CMake?

2019-10-14 Thread David Aldrich
Hi



I am trying to convert a large software project from makefiles to CMake.
The project is organised as a set of shared ‘star’ libraries, linked to a
static ‘kernel’ library. The current directory arrangement is:



|--stars

| |-- star1_lib

|  |-- source files

|  |-- makefile

| |-- star2_lib

|  |-- source files

|  |-- makefile

| |-- solibs

|  |-- Release

| |-- .so files

|

|--kernel

| |-- source files

| |-- makefile

| |-- Release

|  |-- kernel.a

|

|--application

  |-- makefile

  |-- Release

   |-- myapp.exe



In high-level terms, how could I implement this using CMake, such that
invoking ‘make’ in directory ‘application’ invokes a make of each shared
and static library, and links them to form ‘myapp.exe’?



(I understand the basics of CMake, the issue here is how to handle the make
of source code and libraries spread across a directory hierarchy).



Best regards



David
-- 

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 support separate debug and release build directories?

2019-06-24 Thread David Aldrich
>
> David,
>
> I think a bit more explanation of the philosophy (at least how I
> interpret it) is needed. I see in your emails that you are “targeting
> makefiles”. With CMake you need to really stop thinking this way. Rarely do
> you need to target any specific build system (although those times do come
> up…). A lot of folks I see coming from autoconf to CMake still try to treat
> CMake in the same way. Don’t. There are a few golden rules with CMake that
> if you adhere to those will allow you to use CMake much easier.
>
>
>
> 1: NEVER have the Source directory and the Build directory be the same
> place.
>
> 2: PREFER out-of-source build directories (Not required but helpful)
>
> 3: Try not to target specific generators (makefiles, visual studio, xcode)
>
> 
>

Hi Michael

Thanks very much for your reply and explanation. As a result, I now have
the separate Debug/Release build subdirectories working correctly.

Best regards

David
-- 

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 support separate debug and release build directories?

2019-06-21 Thread David Aldrich
>
> > What would best practice be to provide convenient commands for our
> > developers to easily build the target ?
>
> For the Makefile generator, best practice is to use separate build
> directories (i.e., places where you run cmake) for different
> configurations (i.e., different settings recorded during the
> configuration step).
>
> If you want to provide developers with some known set(s) of
> configuration settings, I suggest wrapper scripts that invoke cmake
> with those settings.
>
> Thanks for your advice. I am not finding it easy to find 'patterns' for
these sort of issues. I would have thought that configuring a project with
separate debug and release directories would be quite typical. But it's
hard to find the recommended way of doing such things. Anyway, I think I am
on the right track now.
-- 

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 support separate debug and release build directories?

2019-06-21 Thread David Aldrich
>
> > I would also like this to work if I use the make targets e.g. make
> > debug.
>
> I think that's outside the scope of the Makefile generator.  For that
> generator, CMAKE_BUILD_TYPE is a configuration-wide setting.  If you
> want a different configuration, you need a different build directory
> (where "build directory" is wherever you run cmake).
>

If I don't use make targets (so that user can type 'make debug' etc) the
build command would be more cumbersome:

cmake3 --build -D CMAKE_BUILD_TYPE=Debug .

What would best practice be to provide convenient commands for our
developers to easily build the target ?
-- 

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 support separate debug and release build directories?

2019-06-21 Thread David Aldrich
>
> Do never test CMAKE_BUILD_TYPE in CMakeLists.txt files, it is ignored in
> multiple generators (e.g. Visual Studio).
>

Does that mean I shouldn't have this in CMakeLists.txt? :

# Specify a Release build by default
if(NOT CMAKE_BUILD_TYPE)
  set(CMAKE_BUILD_TYPE "Release")
  message(STATUS "Build type not specified: Use Release by default")
endif(NOT CMAKE_BUILD_TYPE)


>
> Just use the appropriate variables that contain suffixes regarding the
> configuration.
>
> e.g
>
> set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/debug)
> set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/release)
>
> See [0] for a list with _ variables.
>
> [0]: https://cmake.org/cmake/help/v3.15/manual/cmake-variables.7.html
>
> HTH
>

Thank you. That is working for me.
-- 

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 support separate debug and release build directories?

2019-06-21 Thread David Aldrich
Thanks for the help I have received in the past few days. I am making
incremental improvements to my CMake project and have a new challenge.  I
am running CMake 3.13 on Centos 7.6, targeting make.  My CMake file
successfully builds debug or release targets and puts the executable in an
out-of-source build directory.  I have added debug and release make targets
so I can execute 'make debug' etc.

I now want to support separate target directories: build/debug and
build/release.  I've shown my CMakeLists.txt below. So far I've just added
an attempt to support build/debug:

if (CMAKE_BUILD_TYPE EQUAL "DEBUG")
message("debug mode")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/debug)
endif (CMAKE_BUILD_TYPE EQUAL "DEBUG")

but:

$ cmake3 -DCMAKE_BUILD_TYPE=DEBUG ..

puts the target into build, not build/debug.

I would also like this to work if I use the make targets e.g. make debug.

Here's my full CMakeLists.txt.  Any advice would be appreciated.

cmake_minimum_required(VERSION 3.5 FATAL_ERROR)

if(NOT CMAKE_BUILD_TYPE)
  set(CMAKE_BUILD_TYPE "Release")
  message(STATUS "Build type not specified: Use Release by default")
endif(NOT CMAKE_BUILD_TYPE)

project(hello_world LANGUAGES CXX)# Among other things, this sets
PROJECT_NAME

add_executable(${PROJECT_NAME} "")

target_include_directories(${PROJECT_NAME}
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR})

target_sources(${PROJECT_NAME}
  PRIVATE
main.cpp
Message.cpp)

ADD_CUSTOM_TARGET(debug
  COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Debug ${CMAKE_SOURCE_DIR}
  COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target all
  COMMENT "Creating the executable in the debug mode.")

ADD_CUSTOM_TARGET(release
  COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR}
  COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target all
  COMMENT "Creating the executable in the release mode.")

if (CMAKE_BUILD_TYPE EQUAL "DEBUG")
message("debug mode")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/debug)
endif (CMAKE_BUILD_TYPE EQUAL "DEBUG")
-- 

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 specify Redhat Developer Toolset compiler?

2019-06-21 Thread David Aldrich
Thanks for all the replies. I decided to set CC and CXX in .bashrc:

source scl_source enable devtoolset-7
export CXX="/opt/rh/devtoolset-7/root/usr/bin/g++"
export CC="/opt/rh/devtoolset-7/root/usr/bin/gcc"

For reference, the FAQ entry is:
https://gitlab.kitware.com/cmake/community/wikis/FAQ#how-do-i-use-a-different-compiler

I wonder why it says to avoid using set()?
-- 

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 specify Redhat Developer Toolset compiler?

2019-06-20 Thread David Aldrich
My Centos 7.6 machine has CMake 3.13.5 and g++ 4.8.5 installed:

$ /usr/bin/x86_64-redhat-linux-g++ --version
x86_64-redhat-linux-g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36)

I have a very simple CMakeLists.txt:

cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
project(hello_world LANGUAGES CXX)

add_executable(hello_world "")

target_sources(hello_world
  PRIVATE
main.cpp
Message.hpp
Message.cpp)

I also have Redhat Developer Toolset 7 installed which I can enable in my
bash shell:

$ scl enable devtoolset-7 bash
$ which g++
/opt/rh/devtoolset-7/root/usr/bin/g++
$ g++ --version
g++ (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)

How can I get CMake to use the later version of g++ instead of 4.8.5?
-- 

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 specify debug version of CRT library for Visual Studio generator?

2019-06-19 Thread David Aldrich
> Just a heads up, CMake 3.15 is introducing policy 91 which removes the
> runtime library from the default set of flags, and instead has targets
> establish what runtime they want.

Thanks for this.

On Tue, Jun 18, 2019 at 7:08 PM Robert Maynard 
wrote:

> Just a heads up, CMake 3.15 is introducing policy 91 which removes the
> runtime library from the default set of flags, and instead has targets
> establish what runtime they want.
>
> For more information see:
> https://cmake.org/cmake/help/v3.15/prop_tgt/MSVC_RUNTIME_LIBRARY.html
>
> On Tue, Jun 18, 2019 at 10:06 AM Eric Dönges  wrote:
> >
> > On 18.06.19 12:53, David Aldrich wrote:
> > > I have a simple CMake project that builds an executable using Visual
> > > Studio 2017:
> >
> >
> > >
> > >  Files 
> > > #   --   Add files to project.   --   #
> > > ###
> > >
> > > file(GLOB SRC_FILES
> > > ${CPP_DIR_1}/*.cpp
> > > ${CPP_DIR_2}/*.cpp
> > > ${CPP_DIR_3}/*.cpp
> > > ${CPP_DIR_4}/*.cpp
> > > ${HEADER_DIR_1}/*.h
> > > )
> > >
> > > # Add executable to build.
> > > add_executable(${PROJECT_NAME}
> > >${SRC_FILES}
> > > )
> > >
> > > if(MSVC)
> > >target_link_libraries(${PROJECT_NAME} ws2_32.lib )
> > > endif(MSVC)
> > >
> > > #=
> > >
> > > The Release build succeeds but the Debug build fails with linker errors
> > > such as:
> > >
> > > [build] CPlaneTest.obj : error LNK2001: unresolved external symbol
> > > __imp___CrtDbgReport
> > >
> > > I think this is because the linker is not using the debug version of
> CRT
> > > (C Run-time Library).
> > >
> > > Should CMake select the debug build of CRT automatically or do I need
> to
> > > specify it manually? If so, should I do so using
> CMAKE_EXE_LINKER_FLAGS?
> > >
> >
> > CMake will select the correct CRT automatically if you let it (unless
> > you want the static CRT, in which case you have to override CMake's
> > default settings). You are setting your CMAKE_CXX_FLAGS_DEBUG
> incorrectly:
> >
> > > if(MSVC)
> > >#set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /D _DEBUG /W3
> > > /MD /Od /Zi /EHsc")
> > >set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /W3 /GL /Od
> > > /Oi /Gy /Zi /EHsc")
> > >set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_RELEASE} /D _DEBUG /W3
> > > /GL /Od /Oi /Gy /Zi /EHsc")
> > > endif(MSVC)
> >
> > In case of the setting you've commented out, you are explicitly telling
> > CMake to use /MD. CMAKE_CXX_FLAGS_DEBUG should already contain /MDd, but
> > since you append the /MD, that is what the compiler will actually use.
> >
> > For the setting that is not commented out, you set CMAKE_CXX_FLAGS_DEBUG
> > to the contents of CMAKE_CXX_FLAGS_RELEASE - which is certainly not what
> > you want (and also specifies /MD).
> >
> > I would suggest looking at what flags CMake sets by default (look at the
> > Windows-MSVC.cmake file in CMake's 'Modules/Platform' directory) and
> > only setting those flags that CMake doesn't already. For version 3.14,
> > CMake should be setting the following flags for CMAKE_CXX_FLAGS_DEBUG by
> > default (assuming you are using MVSC >= 1310, no Clang toolset):
> >
> > /MDd /Zi /Ob0 /Od /GR /EHSC
> >
> > So in your case, it would probably be enough to
> >
> > string(APPEND CMAKE_CXX_FLAGS_DEBUG " /D_DEBUG /W3")
> >
> > As a final recommendation, use string(APPEND  ...) (or list(APPEND
> >  ...), if the variable is interpreted as a list) when appending
> > values to existing variables. This makes your intent clearer.
> >
> >
> >  - when appending compiler flags, use the "string(APPEND ...)" command
> > to make is clearer what you are doing).
> > --
> >
> > 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/trai

Re: [CMake] How to specify debug version of CRT library for Visual Studio generator?

2019-06-19 Thread David Aldrich
>
> > On Tue, Jun 18, 2019 at 3:07 PM Eric Dönges  wrote:
> > On 18.06.19 12:53, David Aldrich wrote:
> > > I have a simple CMake project that builds an executable using Visual
> > > Studio 2017:
> >
> >
> > >
> > >  Files 
> > > #   --   Add files to project.   --   #
> > > ###
> > >
> > > file(GLOB SRC_FILES
> > > ${CPP_DIR_1}/*.cpp
> > > ${CPP_DIR_2}/*.cpp
> > > ${CPP_DIR_3}/*.cpp
> > > ${CPP_DIR_4}/*.cpp
> > > ${HEADER_DIR_1}/*.h
> > > )
> > >
> > > # Add executable to build.
> > > add_executable(${PROJECT_NAME}
> > >${SRC_FILES}
> > > )
> > >
> > > if(MSVC)
> > >target_link_libraries(${PROJECT_NAME} ws2_32.lib )
> > > endif(MSVC)
> > >
> > > #=
> > >
> > > The Release build succeeds but the Debug build fails with linker errors
> > > such as:
> > >
> > > [build] CPlaneTest.obj : error LNK2001: unresolved external symbol
> > > __imp___CrtDbgReport
> > >
> > > I think this is because the linker is not using the debug version of
> CRT
> > > (C Run-time Library).
> > >
> > > Should CMake select the debug build of CRT automatically or do I need
> to
> > > specify it manually? If so, should I do so using
> CMAKE_EXE_LINKER_FLAGS?
> > >
> >
> > CMake will select the correct CRT automatically if you let it (unless
> > you want the static CRT, in which case you have to override CMake's
> > default settings). You are setting your CMAKE_CXX_FLAGS_DEBUG
> incorrectly:
> >
> > > if(MSVC)
> > >#set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /D _DEBUG /W3
> > > /MD /Od /Zi /EHsc")
> > >set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /W3 /GL /Od
> > > /Oi /Gy /Zi /EHsc")
> > >set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_RELEASE} /D _DEBUG /W3
> > > /GL /Od /Oi /Gy /Zi /EHsc")
> > > endif(MSVC)
> >
> > In case of the setting you've commented out, you are explicitly telling
> > CMake to use /MD. CMAKE_CXX_FLAGS_DEBUG should already contain /MDd, but
> > since you append the /MD, that is what the compiler will actually use.
> >
> > For the setting that is not commented out, you set CMAKE_CXX_FLAGS_DEBUG
> > to the contents of CMAKE_CXX_FLAGS_RELEASE - which is certainly not what
> > you want (and also specifies /MD).
> >
> > I would suggest looking at what flags CMake sets by default (look at the
> > Windows-MSVC.cmake file in CMake's 'Modules/Platform' directory) and
> > only setting those flags that CMake doesn't already. For version 3.14,
> > CMake should be setting the following flags for CMAKE_CXX_FLAGS_DEBUG by
> > default (assuming you are using MVSC >= 1310, no Clang toolset):
> >
> > /MDd /Zi /Ob0 /Od /GR /EHSC
> >
> > So in your case, it would probably be enough to
> >
> > string(APPEND CMAKE_CXX_FLAGS_DEBUG " /D_DEBUG /W3")
> >
> > As a final recommendation, use string(APPEND  ...) (or list(APPEND
> >  ...), if the variable is interpreted as a list) when appending
> > values to existing variables. This makes your intent clearer.
> >
> >
> >  - when appending compiler flags, use the "string(APPEND ...)" command
> > to make is clearer what you are doing).
>
> Thanks for your help and advice. I've followed your suggestions and the
> debug
> and release builds are now working correctly. I produced my CMakeLists.txt
> from
> a Visual Studio solution using a conversion utility. I will need to rework
> it to adopt best practices.
>
>
-- 

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 specify debug version of CRT library for Visual Studio generator?

2019-06-18 Thread David Aldrich
I have a simple CMake project that builds an executable using Visual Studio
2017:

#==

cmake_minimum_required(VERSION 3.5 FATAL_ERROR)

### Variables. 
# Change if you want modify path or other values. #
###

set(PROJECT_NAME CPlaneTest)
# Output Variables
set(OUTPUT_DEBUG Debug/bin)
set(OUTPUT_RELEASE Release/bin)
# Folders files
set(CPP_DIR_1 ./)
set(CPP_DIR_2 ./)
set(CPP_DIR_3 ./)
set(CPP_DIR_4 ./)
set(HEADER_DIR_1 )

## CMake Project 
#The main options of project#
#

project(${PROJECT_NAME} CXX)

# Define Release by default.
if(NOT CMAKE_BUILD_TYPE)
  set(CMAKE_BUILD_TYPE "Release")
  message(STATUS "Build type not specified: Use Release by default.")
endif(NOT CMAKE_BUILD_TYPE)

# Definition of Macros
add_definitions(
   -D_CONSOLE
   -DUNICODE
   -D_UNICODE
)

## Artefacts Output #
# Defines outputs , depending Debug or Release. #
#

if(CMAKE_BUILD_TYPE STREQUAL "Debug")
  set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OUTPUT_DEBUG}")
  set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OUTPUT_DEBUG}")
  set(CMAKE_EXECUTABLE_OUTPUT_DIRECTORY
"${CMAKE_BINARY_DIR}/${OUTPUT_DEBUG}")
else()
  set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OUTPUT_REL}")
  set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OUTPUT_REL}")
  set(CMAKE_EXECUTABLE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OUTPUT_REL}")
endif()

# Flags 
# Defines Flags for Windows and Linux. #


if(MSVC)
   #set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /D _DEBUG /W3 /MD
/Od /Zi /EHsc")
   set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /W3 /GL /Od /Oi
/Gy /Zi /EHsc")
   set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_RELEASE} /D _DEBUG /W3 /GL
/Od /Oi /Gy /Zi /EHsc")
endif(MSVC)
if(NOT MSVC)
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
   if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
   set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
   endif()
endif(NOT MSVC)

 Files 
#   --   Add files to project.   --   #
###

file(GLOB SRC_FILES
${CPP_DIR_1}/*.cpp
${CPP_DIR_2}/*.cpp
${CPP_DIR_3}/*.cpp
${CPP_DIR_4}/*.cpp
${HEADER_DIR_1}/*.h
)

# Add executable to build.
add_executable(${PROJECT_NAME}
   ${SRC_FILES}
)

if(MSVC)
   target_link_libraries(${PROJECT_NAME} ws2_32.lib )
endif(MSVC)

#=

The Release build succeeds but the Debug build fails with linker errors
such as:

[build] CPlaneTest.obj : error LNK2001: unresolved external symbol
__imp___CrtDbgReport

I think this is because the linker is not using the debug version of CRT (C
Run-time Library).

Should CMake select the debug build of CRT automatically or do I need to
specify it manually? If so, should I do so using CMAKE_EXE_LINKER_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] How to use CMake with Eclipse CDT?

2016-04-20 Thread David Aldrich
Hi

I want to build an Eclipse CDT (C++) project on Linux that can be maintained 
using CMake.  I have seen the notes on the Eclipse CDT4 Generator here:

https://cmake.org/Wiki/Eclipse_CDT4_Generator

Is the sole purpose of that generator to create a CDT project from a CMake 
makefile?

Or, having run the generator, will CDT continue to maintain the project with 
CMake, adding new source files to CMakeLists.txt as required?  This is what I 
want to achieve, so that my project can be built by another IDE, that 
understands CMake but not CDT, at any time.

Best regards

David

-- 

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:
http://public.kitware.com/mailman/listinfo/cmake

[CMake] How to use CMake with Eclipse CDT?

2016-04-20 Thread David Aldrich
Hi

I want to build an Eclipse CDT (C++) project on Linux that can be maintained 
using CMake.  I have seen the notes on the Eclipse CDT4 Generator here:

https://cmake.org/Wiki/Eclipse_CDT4_Generator

Is the sole purpose of that generator to create a CDT project from a CMake 
makefile?

Or, having run the generator, will CDT continue to maintain the project with 
CMake, adding new source files to CMakeLists.txt as required?  This is what I 
want to achieve, so that my project can be built by another IDE, that 
understands CMake but not CDT, at any time.

Best regards

David

-- 

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:
http://public.kitware.com/mailman/listinfo/cmake

[CMake] Debug / release build types

2011-05-17 Thread David Aldrich
Hi

My understanding is that cmake will automatically set the compiler flags based 
on CMAKE_BUILD_TYPE.  I am wondering whether there is a clean way of specifying 
debug / release 'extra' libraries such that cmake will select the appropriate 
library at link time?

Currently I use this code to link to the open source 'SystemC' library:

if( USE_SYSTEMC )
if( CMAKE_BUILD_TYPE STREQUAL Release )
target_link_libraries( zodiac ${SYSTEMCLIB_R} )
endif( CMAKE_BUILD_TYPE STREQUAL Release )
if( CMAKE_BUILD_TYPE STREQUAL Debug )
target_link_libraries( zodiac ${SYSTEMCLIB_D} )
endif( CMAKE_BUILD_TYPE STREQUAL Debug )
endif( USE_SYSTEMC )

Is there a cleaner way of doing this?

Best regards

David

___
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] Debug / release build types

2011-05-17 Thread David Aldrich
Hi Yuri

Thanks for your answer. I chose to use the OPTIMIZED and DEBUG keywords in 
target_link_libraries for simplicity.

Best regards

David

From: Yuri Timenkov [mailto:y...@timenkov.ru]
Sent: 17 May 2011 11:57
To: David Aldrich
Cc: cmake@cmake.org
Subject: Re: [CMake] Debug / release build types

The best way is to use imported targets, specifying different locations for 
each configuration 
(http://www.cmake.org/Wiki/CMake/Tutorials/Exporting_and_Importing_Targets).

Or simply use OPTIMIZED and DEBUG keywords in target_link_libraries (see 
command help).
On Tue, May 17, 2011 at 1:42 PM, David Aldrich 
david.aldr...@emea.nec.commailto:david.aldr...@emea.nec.com wrote:
Hi

My understanding is that cmake will automatically set the compiler flags based 
on CMAKE_BUILD_TYPE.  I am wondering whether there is a clean way of specifying 
debug / release ‘extra’ libraries such that cmake will select the appropriate 
library at link time?

Currently I use this code to link to the open source ‘SystemC’ library:

if( USE_SYSTEMC )
if( CMAKE_BUILD_TYPE STREQUAL Release )
target_link_libraries( zodiac ${SYSTEMCLIB_R} )
endif( CMAKE_BUILD_TYPE STREQUAL Release )
if( CMAKE_BUILD_TYPE STREQUAL Debug )
target_link_libraries( zodiac ${SYSTEMCLIB_D} )
endif( CMAKE_BUILD_TYPE STREQUAL Debug )
endif( USE_SYSTEMC )

Is there a cleaner way of doing this?

Best regards

David


___
Powered by www.kitware.comhttp://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



Click 
herehttps://www.mailcontrol.com/sr/Ylq8xTHIEMLTndxI!oX7UlEvFrFJ1EkCTuwXX7tNhVsUXjM!FWbGhjHZr!vQ4QakSeCdy7MqYwRrzgsKYpIG1w==
 to report this email as spam.
___
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] make VERBOSE=1

2011-05-17 Thread David Aldrich
Hi 

I would like to see the exact g++ commands that are invoked by a makefile 
generated by cmake.  It seems that the usual advice is to use:

make VERBOSE=1

However, the output is then far more verbose than just the g++ commands.

Is there a way to produce less commentary than VERBOSE=1, but more than the 
default?

Best regards

David
___
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] about FIND_PACKAGE(PythonLibs): Could NOT find PythonLibs

2010-10-05 Thread David Aldrich
I think you should be doing something like:

find_package(PythonLibs REQUIRED)
include_directories(${PYTHON_INCLUDE_DIRS})

You shouldn't be calling SET.

Best regards 

David 


 -Original Message-
 From: cmake-boun...@cmake.org [mailto:cmake-boun...@cmake.org] On Behalf Of
 Richie Hwang
 Sent: 04 October 2010 20:24
 To: cmake@cmake.org
 Subject: [CMake] about FIND_PACKAGE(PythonLibs): Could NOT find PythonLibs
 
 Hi,
 
 I am using swig to bind python and a c++ project. According to the
 example, In my Cmakelist.txt I wrote as follows:
 
 SET(PYTHON_INCLUDE_DIRS C:\\Python27\\include)
 SET(PYTHON_LIBRARIES C:\\Python27\\libs)
 FIND_PACKAGE(PythonLibs)
 
 Still get the errors:
 
 Could NOT find PythonLibs  (missing:  PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS)
 CMake Error: The following variables are used in this project, but
 they are set to NOTFOUND.
 Please set them or make sure they are set and tested correctly in the
 CMake files:
 PYTHON_INCLUDE_DIR (ADVANCED)
used as include directory in directory D:/test_swig/cmake_swig
 PYTHON_LIBRARY (ADVANCED)
 linked by target _scalar_vector_matrix in directory
 D:/test_swig/cmake_swig
 
 Could you please tell my why I still got this error after setting
 PYTHON_INCLUDE_DIRS and PYTHON_LIBRARIES?
 
 Thanks,
 Richie
 ___
 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
 
 
  Click
 https://www.mailcontrol.com/sr/QR6!d3p8FaDTndxI!oX7Umg7i2cqMKDpqtYQ2QUoGuWZLX
 0MCsyBHR3iE!E9p78q8o!I4OToXnBPZmPPpGmKJg==  to report this email as spam.
___
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] Error finding boost libraries

2010-10-01 Thread David Aldrich
Hi

The following command is not working for me:

find_package( Boost 1.40.0 COMPONENTS python REQUIRED )

I get error:

CMake Error at CMakeLists.txt:36 (find_package):
  Could not find module FindBoostLibs.cmake or a configuration file for
  package BoostLibs.

I am running CMake 2.8.2, which contains 'FindBoost.cmake' (NOT 
FindBoostLibs.cmake).

Is this a known problem?

Best regards
David

___
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] CMake Digest, Vol 77, Issue 104

2010-10-01 Thread David Aldrich
Hi

 if(CMAKE_BUILD_TYPE EQUAL Debug)
set(CMAKE_CXX_FLAGS -Wno-long-long -Wno-comment -Wwrite-strings
 -std=c++0x -pedantic-errors -pedantic -Wall -W -g -gdwarf-2 -Weffc++
 -Wmain -Wextra)
 else(CMAKE_BUILD_TYPE EQUAL Debug)
set(CMAKE_CXX_FLAGS -s etc)
 endif(CMAKE_BUILD_TYPE EQUAL Debug)

As a total non-expert I don't see how this will work because if build type is 
Debug then CMake will use CMAKE_CXX_FLAGS_DEBUG not CMAKE_CXX_FLAGS.

Am I right?

Best regards 

David 

 -Original Message-
 From: cmake-boun...@cmake.org [mailto:cmake-boun...@cmake.org] On Behalf Of
 fat...@crackmonkey.us
 Sent: 01 October 2010 09:50
 To: cmake@cmake.org
 Subject: Re: [CMake] CMake Digest, Vol 77, Issue 104
 
 
  Date: Wed, 29 Sep 2010 03:14:57 +0200
  From: Michael Hertling mhertl...@online.de
  Subject: Re: [CMake] How to set compiler flags?
  To: cmake@cmake.org
  Message-ID: 4ca29311.1050...@online.de
  Content-Type: text/plain; charset=ISO-8859-1
 
   [...] So I now use add_definitions instead:
  
   add_definitions( -Wall -m64 -O3 )
  
   Is there a better way of doing this?
 
  Don't do this at all, and adhere to the flags.
 
 
 Interesting - I've been doing this:
 
 if(CMAKE_BUILD_TYPE EQUAL Debug)
set(CMAKE_CXX_FLAGS -Wno-long-long -Wno-comment -Wwrite-strings
 -std=c++0x -pedantic-errors -pedantic -Wall -W -g -gdwarf-2 -Weffc++
 -Wmain -Wextra)
 else(CMAKE_BUILD_TYPE EQUAL Debug)
set(CMAKE_CXX_FLAGS -s etc)
 endif(CMAKE_BUILD_TYPE EQUAL Debug)
 
 because it never occurred to me to do it another way.
 
 Is this wrong too?
 
 Regards,
 Adam J Richardson
 ___
 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
 
 
  Click
 https://www.mailcontrol.com/sr/m3Ke1Zwh72LTndxI!oX7Umg7i2cqMKDpatpcVrYsfjchek
 5ARGEPIsf3rgJ09!IBCXmG77JHsOszZ1ZqAaZkbg==  to report this email as spam.
___
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] CMAKE_CXX_FLAGS [was: Re: CMake Digest, Vol 77, Issue 104]

2010-10-01 Thread David Aldrich
You can run cmake and then:

make VERBOSE=1

to see the flags.

Best regards 

David 


 -Original Message-
 From: cmake-boun...@cmake.org [mailto:cmake-boun...@cmake.org] On Behalf Of
 fat...@crackmonkey.us
 Sent: 01 October 2010 10:48
 To: David Aldrich
 Cc: cmake@cmake.org
 Subject: [CMake] CMAKE_CXX_FLAGS [was: Re: CMake Digest, Vol 77, Issue 104]
 
 
 On Fri, 1 Oct 2010 10:23:30 +0100
 David Aldrich david.aldr...@eu.nec.com wrote:
 
   if(CMAKE_BUILD_TYPE EQUAL Debug)
  set(CMAKE_CXX_FLAGS -Wno-long-long -Wno-comment -Wwrite-strings
   -std=c++0x -pedantic-errors -pedantic -Wall -W -g -gdwarf-2 -Weffc++
   -Wmain -Wextra)
   else(CMAKE_BUILD_TYPE EQUAL Debug)
  set(CMAKE_CXX_FLAGS -s etc)
   endif(CMAKE_BUILD_TYPE EQUAL Debug)
 
  As a total non-expert I don't see how this will work because if build
  type is Debug then CMake will use CMAKE_CXX_FLAGS_DEBUG not
  CMAKE_CXX_FLAGS.
 
  Am I right?
 
 Could be. I too am a non-expert. CMake doesn't seem to output the
 command lines it executes, or if it does then Buildbot ignores it. This
 is the view from Buildbot's IO log:
 
 cd cmake  make all  cd ..
  in dir /home/arichardson/buildbot/Reu2/bin/vostro/build (timeout 1200
 secs)
  watching logfiles {}
  argv: cd cmake  make all  cd ..
  environment:
 snip lots of wrappily long env vars
  closing stdin
  using PTY: False
 [  2%] Building CXX object
 SmallTestLib/CMakeFiles/SmallTestLib.dir/src/SmallTestLib.cc.o
 Linking CXX shared library ../../bin/libSmallTestLib-d.so
 [  2%] Built target SmallTestLib
 [  5%] Building CXX object Reu2/CMakeFiles/Reu2.dir/src/TrayIcon.cc.o
 [  8%] Building CXX object Reu2/CMakeFiles/Reu2.dir/src/Transformer.cc.o
 snip lots of very similar lines, you get the idea I think
 [ 47%] Building CXX object
 Reu2/CMakeFiles/Reu2.dir/src/CommonFunctions.cc.o
 [ 50%] Building CXX object Reu2/CMakeFiles/Reu2.dir/src/Buffer.cc.o
 Linking CXX static library ../../bin/libReu2-d.a
 [ 50%] Built target Reu2
 [ 52%] Building CXX object
 Test-Reu2/CMakeFiles/Test-Reu2.dir/src/Test-TrayIcon.cc.o
 [ 55%] Building CXX object
 Test-Reu2/CMakeFiles/Test-Reu2.dir/src/Test-Transformer.cc.o
 snip
 [ 94%] Building CXX object
 Test-Reu2/CMakeFiles/Test-Reu2.dir/src/Test-Database.cc.o
 [ 97%] Building CXX object
 Test-Reu2/CMakeFiles/Test-Reu2.dir/src/Test-Converter.cc.o
 [100%] Building CXX object
 Test-Reu2/CMakeFiles/Test-Reu2.dir/src/Test-Buffer.cc.o
 Linking CXX executable ../../bin/Test-Reu2
 [100%] Built target Test-Reu2
 program finished with exit code 0
 elapsedTime=15.055892
 
 Can I make CMake more verbose? The IO log above contains the command
 line executed by Buildbot (cd cmake  make all  cd ..).
 ___
 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
 
 
  Click
 https://www.mailcontrol.com/sr/KnN8vD3kmCjTndxI!oX7UhTphzU8DZg3pxxqfRn99ayTQI
 SvUXhIjiTv2BReO0f0CXmG77JHsOtRu1zEhLyH4w==  to report this email as spam.
___
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] Error finding boost libraries

2010-10-01 Thread David Aldrich
Hi

Actually, I made an error in my CMakeLists.txt file. It's fixed now. 

Sorry for raising this.

Best regards 

David 


 -Original Message-
 From: cmake-boun...@cmake.org [mailto:cmake-boun...@cmake.org] On Behalf Of
 fat...@crackmonkey.us
 Sent: 01 October 2010 10:55
 To: David Aldrich
 Cc: cmake@cmake.org
 Subject: [CMake] Error finding boost libraries
 
 
  From: David Aldrich david.aldr...@eu.nec.com
  Subject:
  To: cmake@cmake.org cmake@cmake.org
 
  The following command is not working for me:
 
  find_package( Boost 1.40.0 COMPONENTS python REQUIRED )
 
  I get error:
 
  CMake Error at CMakeLists.txt:36 (find_package):
Could not find module FindBoostLibs.cmake or a configuration file
  for package BoostLibs.
 
  I am running CMake 2.8.2, which contains 'FindBoost.cmake' (NOT
  FindBoostLibs.cmake).
 
  Is this a known problem?
 
 I notice you specify Boost.Python.
 
 This is possibly a non-sequitur, but I've had problems with Boost.Python
 in the past, in particular when I tried to compose a pkg-config file
 (.pc) for it. The rest of Boost works just fine with pkg-config, as it
 turns out. It's just Boost.Python I had to give up on.
 
 IMO, the Boost.Python binary is inherently warped.
 ___
 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
 
 
  Click
 https://www.mailcontrol.com/sr/gftAzfyUCWnTndxI!oX7Uqfv98hA5qioTS!VTX3ywk3TVd
 KH!wCDQLmj5KHvHT3ECXmG77JHsOtRu1zEhLyH4w==  to report this email as spam.
___
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 set compiler flags?

2010-10-01 Thread David Aldrich
Hi Michael

 Wrong. CMAKE_CXX_FLAGS is always used, the configuration-specific values are
 appended to it.

This is where I groan a little. I haven't read that in the online documentation.

Best regards 

David
___
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 set compiler flags?

2010-10-01 Thread David Aldrich
Well I can't argue with that, but I must admit that I have not read 
CMakeCache.txt ;-)

David 


 -Original Message-
 From: Michael Wild [mailto:them...@gmail.com]
 Sent: 01 October 2010 11:53
 To: David Aldrich
 Cc: fat...@crackmonkey.us; cmake@cmake.org
 Subject: Re: [CMake] How to set compiler flags?
 
 
 On 1. Oct, 2010, at 12:45 , David Aldrich wrote:
 
  Hi Michael
 
  Wrong. CMAKE_CXX_FLAGS is always used, the configuration-specific
  values are appended to it.
 
  This is where I groan a little. I haven't read that in the online
 documentation.
 
  Best regards
 
  David
 
 
 Couldn't find it in the docs either (just had a superficial look), but in the
 CMakeCache.txt it says cleary:
 
 //Flags used by the compiler during all build types.
 CMAKE_CXX_FLAGS:STRING=
 
 //Flags used by the compiler during debug builds.
 CMAKE_CXX_FLAGS_DEBUG:STRING=-g
 
 ...
 
 
 Michael
 
 --
 There is always a well-known solution to every human problem -- neat,
 plausible, and wrong.
 H. L. Mencken

___
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 specify -fpic ?

2010-09-30 Thread David Aldrich
Hi Michael

Thanks for your reply.

 The only difference between -fpic and -fPIC is that the latter has no limit
 on the size of the global offsets table and this is only relevant for the
 m68k, PowerPC and SPARC architectures (according to the GCC manual page). 

Yes, we aren't using those architectures.

 Are you using -fvisibility=hidden somewhere?

No.

 Is this option the only difference of the link commands?

Actually, the shared library linker commands are similar but the executable 
linker commands are quite different.

CMake:

/usr/bin/c++ -O3 -DNDEBUG -Wall -m64 -o myProj -rdynamic Kernel/libKernel.a 
-lpython2.4

Manual make:

g++ -o myProj -ldl -Wl,-whole-archive,-export-dynamic ../Kernel/libKernel.a  
-lboost_python-mt -lpython2.4 -Wl,--no-whole-archive

I will have to analyse these flags. Any thoughts on the use of 
-whole-archive/--no-whole-archive here please?

BR

David


___
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 specify -fpic ?

2010-09-30 Thread David Aldrich
Hi Michael
 
 For one, you are missing -ldl. Add ${CMAKE_DL_LIBS} to your
 target_link_libraries call. 

Thanks for pointing that out. It's in there now:

/usr/bin/c++ -O3 -DNDEBUG -Wall -m64 -o myProj -rdynamic Kernel/libKernel.a 
-ldl -lpython2.4

 --export-dynamic may be also necessary, if your dlopen'ed
 libraries use symbols in your executable.

I tried adding:

SET(CMAKE_EXE_EXPORTS_CXX_FLAG -Wl,--export-dynamic)

But that made no difference to the link command. Am I doing the right thing?

David
___
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 specify -fpic ?

2010-09-30 Thread David Aldrich
Hi

 I tried adding:
 
 SET(CMAKE_EXE_EXPORTS_CXX_FLAG -Wl,--export-dynamic)
 
 But that made no difference to the link command. Am I doing the right thing?

Fixed this by doing:

SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS )
...
SET_TARGET_PROPERTIES(zodiac PROPERTIES ENABLE_EXPORTS ON)

I now have:

/usr/bin/c++   -O3 -DNDEBUG -Wall -m64  -Wl,--export-dynamic   -o myProj  
Kernel/libKernel.a -ldl -lpython2.4

But I still have the shared library load error.

So now I need to try implementing -whole-archive/--no-whole-archive to see if 
that makes a difference.

Any hints how to do this please?

David

___
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 specify -fpic ?

2010-09-30 Thread David Aldrich
Hi

Ok, by following the link to the wiki suggested by Michael Loose, I used:

target_link_libraries( myProj -Wl,-whole-archive Kernel -Wl,-no-whole-archive)

This has fixed my problem. The executable links and runs correctly.

My link command is now:

/usr/bin/c++   -O3 -DNDEBUG -Wall -m64  -Wl,--export-dynamic   -o myProj 
-Wl,-whole-archive Kernel/libKernel.a -Wl,-no-whole-archive -ldl -lpython2.4

I don't need portability so I think this is ok.

Michael Wild wrote:

 The -whole-archive flag is pretty useless with executables 
 (unless, you plan to use it as a library too, but that is 
 outlandish). --export-dynamic may be also necessary, if 
 your dlopen'ed libraries use symbols in your executable.

So my concern is now: am I being 'outlandish' ?  The dlopen'ed libraries do use 
functions in libKernel.a that is linked to the executable. Is this outlandish? 
Is there a better way?

Thanks for your help so far.

Best regards 

David 
___
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 specify -fpic ?

2010-09-30 Thread David Aldrich
Hi Michael

 So, the options are:
 
 - use -whole-archive as you do now
 - make the Kernel library shared
 - link the dlopen'ed libraries against Kernel

Thanks very much - I understand. I think I will keep the -whole-archive method.

However, now I'm worried about how I link in the Python library:

/usr/bin/c++ -O3 -DNDEBUG -Wall -m64 -o myProj -rdynamic -Wl,-whole-archive 
Kernel/libKernel.a -Wl,-no-whole-archive -ldl -lpython2.4

The dlopen'ed libraries may use the Python library. I guess I could include it 
in the -whole-archive part, but perhaps it would be better to link each shared 
library against Python. Would you agree?

Sorry that I am now off topic w.r.t cmake.

By the way, I think I am pretty much there with changing our build system from 
manually coded makefiles to cmake. I like cmake!  Thanks for all your help in 
getting there.  The support on this list is excellent.

Best regards 

David 

 -Original Message-
 From: Michael Wild [mailto:them...@gmail.com]
 Sent: 30 September 2010 12:20
 To: David Aldrich
 Cc: cmake@cmake.org
 Subject: Re: [CMake] How to specify -fpic ?
 
 
 On 30. Sep, 2010, at 13:05 , David Aldrich wrote:
 
  Hi
 
  Ok, by following the link to the wiki suggested by Michael Loose, I used:
 
  target_link_libraries( myProj -Wl,-whole-archive Kernel
  -Wl,-no-whole-archive)
 
  This has fixed my problem. The executable links and runs correctly.
 
  My link command is now:
 
  /usr/bin/c++   -O3 -DNDEBUG -Wall -m64  -Wl,--export-dynamic   -o myProj -
 Wl,-whole-archive Kernel/libKernel.a -Wl,-no-whole-archive -ldl -lpython2.4
 
  I don't need portability so I think this is ok.
 
  Michael Wild wrote:
 
  The -whole-archive flag is pretty useless with executables (unless,
  you plan to use it as a library too, but that is outlandish).
  --export-dynamic may be also necessary, if your dlopen'ed libraries
  use symbols in your executable.
 
  So my concern is now: am I being 'outlandish' ?  The dlopen'ed libraries do
 use functions in libKernel.a that is linked to the executable. Is this
 outlandish? Is there a better way?
 
 The outlandish referred to using an executable also as a library, so you're
 fine :-) But I think I found the reason for why you need this -whole-archive
 flag: Since your executable doesn't use all of the functions in the Kernel
 library, the linker throws them away. This results in your dlopen'ed
 functions to fail.
 
 So, the options are:
 
 - use -whole-archive as you do now
 - make the Kernel library shared
 - link the dlopen'ed libraries against Kernel
 
 Michael
 

___
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 specify -fpic ?

2010-09-30 Thread David Aldrich
Hi Marcel

 Considering all the hassle you have to go through. Why don't you build a
 shared libKernel.so library and let the runtime loader fix all the
 issues you're now trying to solve compile/link time?

Thanks for your suggestion. I'm not sure how that would work out. At start-up 
the runtime linker would only need to resolve issues between main.cpp, 
libKernel.so and libPython.so. Later I will dlopen some more libraries that 
need libKernel. Would the runtime linker handle that?

BR

David
___
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 set compiler flags?

2010-09-29 Thread David Aldrich
Hi Michael

  [...] So I now use add_definitions instead:
 
  add_definitions( -Wall -m64 -O3 )
 
  Is there a better way of doing this?
 
 Don't do this at all, and adhere to the flags.

Thanks for your advice.

 Doesn't the DEBUG variant of the flags, e.g. CMAKE_CXX_FLAGS_DEBUG, and
 other related variables - perhaps in connection with CMAKE_BUILD_TYPE -
 work for you?

Regarding CMAKE_CXX_FLAGS and CMAKE_CXX_FLAGS_RELEASE, is CMAKE_CXX_FLAGS used 
if no build type is specified and CMAKE_CXX_FLAGS_RELEASE used if the build 
type is Release?

If that is so, I plan to assign my desired release options to 
CMAKE_CXX_FLAGS_RELEASE and assign that variable to CMAKE_CXX_FLAGS. That way, 
a release build will happen by default (no build type specified) or if 
Release is specified. I can handle debug builds using CMAKE_CXX_FLAGS_DEBUG.

Am I understanding correctly?

Best regards 

David 


 -Original Message-
 From: cmake-boun...@cmake.org [mailto:cmake-boun...@cmake.org] On Behalf Of
 Michael Hertling
 Sent: 29 September 2010 02:15
 To: cmake@cmake.org
 Subject: Re: [CMake] How to set compiler flags?
 
 On 09/28/2010 05:35 PM, David Aldrich wrote:
  Hi
 
  I am writing CMakeLists.txt files for my C++ application. Initially I set
 the C++ compiler flags by setting CMAKE_CXX_FLAGS:
 
  set( CMAKE_CXX_FLAGS -Wall -m64 -O3  )
 
  Then I realised that those flags get passed to the linker as well, which
 seemed a bit untidy. [...]
 
 But possibly necessary:
 
 http://www.cmake.org/pipermail/cmake/2010-July/038083.html
 
 et seq.
 
  [...] So I now use add_definitions instead:
 
  add_definitions( -Wall -m64 -O3 )
 
  Is there a better way of doing this?
 
 Don't do this at all, and adhere to the flags.
 
  My CMakeLists.txt files only handle a release build currently. If you could
 give me a hint for how to go on to add a debug build option, I would be
 grateful.
 
 Doesn't the DEBUG variant of the flags, e.g. CMAKE_CXX_FLAGS_DEBUG, and
 other related variables - perhaps in connection with CMAKE_BUILD_TYPE -
 work for you?
 
 Regards,
 
 Michael
 ___
 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
 
 
  Click
 https://www.mailcontrol.com/sr/g!Zu+tz8WoHTndxI!oX7Uq0JINmXjwVqUAeEJxkrmVZ0jY
 kyJOOpuMF6ri4kt+pzfxoBRqvSue5ICd5VsZuQpQ==  to report this email as spam.
___
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 set compiler flags?

2010-09-29 Thread David Aldrich
Hi

 If that is so, I plan to assign my desired release options to
 CMAKE_CXX_FLAGS_RELEASE and assign that variable to CMAKE_CXX_FLAGS. That way,
 a release build will happen by default (no build type specified) or if
 Release is specified. I can handle debug builds using CMAKE_CXX_FLAGS_DEBUG.

Sorry, I have misunderstood. No need to answer.

David

  -Original Message-
  From: cmake-boun...@cmake.org [mailto:cmake-boun...@cmake.org] On Behalf Of
  Michael Hertling
  Sent: 29 September 2010 02:15
  To: cmake@cmake.org
  Subject: Re: [CMake] How to set compiler flags?
 
  On 09/28/2010 05:35 PM, David Aldrich wrote:
   Hi
  
   I am writing CMakeLists.txt files for my C++ application. Initially I set
  the C++ compiler flags by setting CMAKE_CXX_FLAGS:
  
   set( CMAKE_CXX_FLAGS -Wall -m64 -O3  )
  
   Then I realised that those flags get passed to the linker as well, which
  seemed a bit untidy. [...]
 
  But possibly necessary:
 
  http://www.cmake.org/pipermail/cmake/2010-July/038083.html
 
  et seq.
 
   [...] So I now use add_definitions instead:
  
   add_definitions( -Wall -m64 -O3 )
  
   Is there a better way of doing this?
 
  Don't do this at all, and adhere to the flags.
 
   My CMakeLists.txt files only handle a release build currently. If you
 could
  give me a hint for how to go on to add a debug build option, I would be
  grateful.
 
  Doesn't the DEBUG variant of the flags, e.g. CMAKE_CXX_FLAGS_DEBUG, and
  other related variables - perhaps in connection with CMAKE_BUILD_TYPE -
  work for you?
 
  Regards,
 
  Michael
  ___
  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
 
 
   Click
 
 https://www.mailcontrol.com/sr/g!Zu+tz8WoHTndxI!oX7Uq0JINmXjwVqUAeEJxkrmVZ0jY
  kyJOOpuMF6ri4kt+pzfxoBRqvSue5ICd5VsZuQpQ==  to report this email as spam.
 ___
 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] How to specify -fpic ?

2010-09-29 Thread David Aldrich
Hi

My C++ code consists of an executable and several shared libraries.

With my CMake build files, I find that the executable fails to load the shared 
libraries ( the dlopen() call results in error 'undefined symbol...' ).

The software works fine under our production build system that uses manually 
coded makefiles.

I notice that the production system linker command invokes -fpic, while CMake 
uses -fPIC. I am wondering if that is the reason.

I set the compile flags with:

set( CMAKE_CXX_FLAGS_RELEASE -O3 -DNDEBUG -Wall -m64 )

How can I replace -fPIC with -fpic in CMake please?

Best regards
David



___
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 set compiler flags?

2010-09-28 Thread David Aldrich
Hi

I am writing CMakeLists.txt files for my C++ application. Initially I set the 
C++ compiler flags by setting CMAKE_CXX_FLAGS:

set( CMAKE_CXX_FLAGS -Wall -m64 -O3  )

Then I realised that those flags get passed to the linker as well, which seemed 
a bit untidy. So I now use add_definitions instead:

add_definitions( -Wall -m64 -O3 )

Is there a better way of doing this?

My CMakeLists.txt files only handle a release build currently. If you could 
give me a hint for how to go on to add a debug build option, I would be 
grateful.

Best regards
David

___
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] Newbie question about cmake dependency generator

2010-09-24 Thread David Aldrich
Hi

Surely been asked before, but may I ask:

Does the cmake dependency generator operate when cmake is invoked or when make 
is subsequently invoked?

Does it use a traditional method such as makedepend or is it unique to cmake?

Thanks

David
___
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] Question regarding project structure

2010-09-17 Thread David Aldrich
Hi Michael

 ADD_EXECUTABLE(exe )

Thanks, that worked nicely.

David
___
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] Execution order

2010-09-17 Thread David Aldrich
Hi

I want to generate a source file 'SourceFileInfo.cpp', then build a library and 
then delete the generated file.

So I wrote:

snip

add_custom_command (
  OUTPUT SourceFileInfo.cpp
  COMMAND ../VersionInfo/_gnuRelease/versionInfo . KERNEL
  DEPENDS ${SRCS}
  COMMENT Generating SourceFileInfo.cpp
  VERBATIM)

list(APPEND SRCS SourceFileInfo.cpp)

add_library( Kernel STATIC ${SRCS} )

message(Removing file)
file( REMOVE SourceFileInfo.cpp )

But the message 'Removing file' appears as the first action when executing make 
and the file remains after make has finished.

I guess that one can't interpret a CMakeLists.txt file sequentially, just like 
you can't interpret a makefile sequentially.

What am I doing wrong?

Where can I find an explanation of CMake command ordering?

Best regards
David

___
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] Execution order

2010-09-17 Thread David Aldrich
Hi Chris

Thanks for your reply.

The message() and file(REMOVE) commands will be executed when you run CMake.
The command to generate the .cpp file won't be executed until you run make.

I don't think I have 'got' CMake yet. I am now definitely confused!

During normal development, i.e. when the CMakeLists.txt files are complete, do 
I execute CMake or make to build the app?

If the answer is 'make', what is the point of functions such as message() and 
file() only working when I execute CMake?

I am struggling with the online CMake documentation. The API is well defined, 
but there seems to be description of CMake concepts. Some more words would be 
helpful!

 Wouldn't it make more sense to generate the source file into the binary 
 directory and just leave it there?

Yes, that's a good point. I will look at doing it that way. My only argument 
against it is that I will have to configure svn to ignore that source file.
David

From: c...@lambda.nu [mailto:c...@lambda.nu] On Behalf Of Chris Hillery
Sent: 17 September 2010 11:05
To: David Aldrich
Cc: cmake@cmake.org
Subject: Re: [CMake] Execution order

The message() and file(REMOVE) commands will be executed when you run CMake. 
The command to generate the .cpp file won't be executed until you run make. 
That's why it's still around after you're done.

You can't really do exactly what you want here very easily; you'd need to have 
a separate custom command to delete the file after the build is complete, and 
I'm not sure how to set up the dependencies to automate that for you.

Why do you want this? Wouldn't it make more sense to generate the source file 
into the binary directory and just leave it there? Your add_custom_command() 
and list(APPEND SRCS) steps below will do this if you just change the OUTPUT to 
${CMAKE_CURRENT_BINARY_DIR}/SourceFileInfo.cpp. This would have the added 
benefit of not forcing a rebuild of SourceFileInfo.o every time you run make.

Ceej
aka Chris Hillery
On Fri, Sep 17, 2010 at 2:53 AM, David Aldrich 
david.aldr...@eu.nec.commailto:david.aldr...@eu.nec.com wrote:
Hi

I want to generate a source file 'SourceFileInfo.cpp', then build a library and 
then delete the generated file.

So I wrote:

snip

add_custom_command (
  OUTPUT SourceFileInfo.cpp
  COMMAND ../VersionInfo/_gnuRelease/versionInfo . KERNEL
  DEPENDS ${SRCS}
  COMMENT Generating SourceFileInfo.cpp
  VERBATIM)

list(APPEND SRCS SourceFileInfo.cpp)

add_library( Kernel STATIC ${SRCS} )

message(Removing file)
file( REMOVE SourceFileInfo.cpp )

But the message 'Removing file' appears as the first action when executing make 
and the file remains after make has finished.

I guess that one can't interpret a CMakeLists.txt file sequentially, just like 
you can't interpret a makefile sequentially.

What am I doing wrong?

Where can I find an explanation of CMake command ordering?
Best regards
David


___
Powered by www.kitware.comhttp://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



Click 
herehttps://www.mailcontrol.com/sr/ko0+lZXnTAXTndxI!oX7UnAXsNktwyv39r1GFf+ITgBAMWnAT6em9peNQt!hhhplKiXbDbOtE1J8TccP!XTbKg==
 to report this email as spam.
___
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] Execution order

2010-09-17 Thread David Aldrich
Hi Chris

 No, you shouldn't have to, unless you're using in-source builds 
 which is very strongly deprecated. Once you've gotten used to 
 out-of-source builds you'll never want to go back. 

Ok, I'm trying to think of how this would work for us.

The source for each of our libraries is in a separate subdirectory as you would 
expect. The subdirectory structure is:

Subdir - .cpp files
 |
 |-- Makefile
 |
 |-- _gnuDebug  === .o and .a files for Debug build
 |
 |-- _gnuRelease=== .o and .a files for Release build

Would you call that an out-of-source build, or would you require the Makefile 
to be in a 'Build' subdirectory below the source?

Or, would you really like to see the build files somewhere to the side of the 
source files?

Best regards

David
___
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] Execution order

2010-09-17 Thread David Aldrich
Hi Ryan

Thanks for your reply.

CMakeLists.txt always lives in the source directory I assume?

If it does live with the source, is there anyway of moving the clutter of 
cmake_install.cmake, CMakeFiles etc. in the source directory?
David

From: Ryan Pavlik [mailto:rpav...@iastate.edu]
Sent: 17 September 2010 13:07
To: David Aldrich
Cc: Chris Hillery; cmake@cmake.org
Subject: Re: [CMake] Execution order

Your build system would be independent where the output files are: the user can 
choose whatever build directory they want, and not be limited to _gnuDebug and 
_gnuRelease.  (If they so chose, they could create each of those and configure 
a build into them, but they are just as likely to not do so. Actually, as I 
look at your info again, it looks like you're making lots of those _gnuRelease 
directories - that definitely looks like an in-source build.)  If that's a 
policy you want to encourage in your organization, that's just fine, but to 
CMake, you should keep things relative to 
CMAKE_SOURCE_DIR/CMAKE_CURRENT_SOURCE_DIR and 
CMAKE_BINARY_DIR/CMAKE_CURRENT_BINARY_DIR.  The general guideline is to never 
modify or generate anything into the _SOURCE_DIR - only into the _BINARY_DIR, 
that way you can get back to a clean source tree by just deleting the build 
directory.  The makefiles generated by CMake will all be in the binary 
directory (and as a preemptive warning: don't commit the generated makefiles to 
source control, they are not machine-independent), so that's where you'd run 
make.

Hope this helps!

Ryan
On Fri, Sep 17, 2010 at 6:24 AM, David Aldrich 
david.aldr...@eu.nec.commailto:david.aldr...@eu.nec.com wrote:
Hi Chris

 No, you shouldn't have to, unless you're using in-source builds
 which is very strongly deprecated. Once you've gotten used to
 out-of-source builds you'll never want to go back.
Ok, I'm trying to think of how this would work for us.

The source for each of our libraries is in a separate subdirectory as you would 
expect. The subdirectory structure is:

Subdir - .cpp files
|
|-- Makefile
|
|-- _gnuDebug  === .o and .a files for Debug build
|
|-- _gnuRelease=== .o and .a files for Release build

Would you call that an out-of-source build, or would you require the Makefile 
to be in a 'Build' subdirectory below the source?

Or, would you really like to see the build files somewhere to the side of the 
source files?

Best regards

David
___
Powered by www.kitware.comhttp://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



--
Ryan Pavlik
HCI Graduate Student
Virtual Reality Applications Center
Iowa State University

rpav...@iastate.edumailto:rpav...@iastate.edu
http://academic.cleardefinition.com
Internal VRAC/HCI Site: http://tinyurl.com/rpavlik


Click 
herehttps://www.mailcontrol.com/sr/sDHIg6kU9Y3TndxI!oX7UkEBkbd6cai+DXsVObJbxJ9BToqwBJZDqD0mc0MEr5X2KiXbDbOtE1JPcbrY0G8NdQ==
 to report this email as spam.
___
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] Execution order

2010-09-17 Thread David Aldrich
Hi Michael

 Ok, to clear things up:
snip
 I hope you get the idea.

Thanks very much, I think I get it now!  I have implemented an out-of-source 
build tree for our project, as you suggested, and it is building fine.

I'm wondering what my co-developers will think of it. It is usual for us to 
work in the source directory of a certain library, make modifications and then 
type make to build just that library.  With this out-of-source build tree it 
will be necessary to hop from the source dir to the build tree, type make there 
and let the entire project build (i.e. other libraries and the executable as 
well). Am I understanding correctly?

 So, I usually have something like this:
 
 ~/Projects/super_duper   --- source tree
 ~/Projects/super_duper-build/debug   --- debugging build tree
 ~/Projects/super_duper-build/release --- release build tree
 ~/Projects/super_duper-build/dashboards  --- parent directory for dashboard 
 builds

Do you usually let the libraries and executables live in the subdirectories 
where CMake would naturally put them? 

For example, some of my build artifacts would be:

super_duper-build/release/Kernel/libKernel.a
super_duper-build/release/VersionInfo/versionInfo

Or would good practice me to put them somewhere more obvious?

Best regards

David
___
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] Question regarding project structure

2010-09-16 Thread David Aldrich
Hi

I have now successfully configured CMakeLists files to create some of our 
static and dynamic libraries using CMake.  I would now like some advice on how 
to configure these separate build files as a single project.

Here's what our current folder structure is like:

Trunk --- Kernel   a static library containing main()
 |
 |--- DynLibs  containg multiple folders containing
 |  proprietary source code, each folder
 |  builds one shared library
 |
 |--- MyExe    contains top-level makefile that
a) links Kernel static library into an .exe
b) calls makefiles for the dynamic libraries

This structure may not be ideal from a CMake standpoint, but I would like to 
maintain it to ease the transition from pure gnu make to CMake.

What would I need to put in the top-level CMakeLists file 
(MyExe/CMakeLists.txt) to reference the other CMakeLists files?

Should each CMakeLists file have its own Project name, or should they all be 
the same?

Any advice would be much appreciated.

Best regards

David
___
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] Question regarding project structure

2010-09-16 Thread David Aldrich
Hi David

Thanks very much - I will give that a try. By the way, we are building on Linux 
only.

If I specify compiler flags in my top level CMakeLists file, I guess that the 
lower level ones will inherit those settings and store them in their local 
caches. Then a lower level CMake may be performed manually and still inherit 
those settings. But this would require the top-level CMakeLists file to have 
been executed at some point previously. Am I correct?

We store our code in svn. Followiing a clean checkout of the code, is there a 
way that I can ensure that a developer has executed the top level makefile 
before attempting to invoke individual library makefiles, so that he can be 
sure that he has the correct compiler flags?

(We achieved this previously by including a top-level settings file in each 
makefile).

Best regards

David

From: David Cole [mailto:david.c...@kitware.com]
Sent: 16 September 2010 11:58
To: David Aldrich
Cc: cmake@cmake.org
Subject: Re: [CMake] Question regarding project structure

On Thu, Sep 16, 2010 at 6:45 AM, David Aldrich 
david.aldr...@eu.nec.commailto:david.aldr...@eu.nec.com wrote:
Hi

I have now successfully configured CMakeLists files to create some of our 
static and dynamic libraries using CMake.  I would now like some advice on how 
to configure these separate build files as a single project.

Here's what our current folder structure is like:

Trunk --- Kernel   a static library containing main()
|
|--- DynLibs  containg multiple folders containing
|  proprietary source code, each folder
|  builds one shared library
|
|--- MyExe    contains top-level makefile that
   a) links Kernel static library into an .exe
   b) calls makefiles for the dynamic libraries

This structure may not be ideal from a CMake standpoint, but I would like to 
maintain it to ease the transition from pure gnu make to CMake.

CMake is flexible about where source files are located. This structure looks 
perfectly reasonable.


What would I need to put in the top-level CMakeLists file 
(MyExe/CMakeLists.txt) to reference the other CMakeLists files?

Something like this should work:

cmake_minimum_required(VERSION 2.8)
project(MyExe)

add_subdirectory(../Kernel Kernel)
add_subdirectory(../DynLibs DynLibs)

add_executable(MyExe exe.cxx)
target_link_libraries(MyExe Kernel)


If your DynLibs build dll files on Windows, the easiest way to get them to load 
into the exe is to use the RUNTIME_OUTPUT_DIRECTORY target property. (Just put 
the exe and the dlls all in the same folder with each other...)
http://www.cmake.org/cmake/help/cmake-2-8-docs.html#prop_tgt:RUNTIME_OUTPUT_DIRECTORY

Or just once in your top level CMakeLists, the CMAKE_RUNTIME_OUTPUT_DIRECTORY 
variable:
http://www.cmake.org/cmake/help/cmake-2-8-docs.html#variable:CMAKE_RUNTIME_OUTPUT_DIRECTORY



Should each CMakeLists file have its own Project name, or should they all be 
the same?

Only the top one *needs* a project command, but if you do have project commands 
in your other CMakeLists.txt files, they should definitely each be unique.


Any advice would be much appreciated.

Best regards

David
___
Powered by www.kitware.comhttp://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


HTH,
David C.



Click 
herehttps://www.mailcontrol.com/sr/NU6aVxvGVgvTndxI!oX7Uv3k+FkN6HRUneeEXaJdAcTHag+0Uqgm21LO1pIkrfrEk+T08o1InrG6Rmyxrg+4Pw==
 to report this email as spam.
___
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] Question regarding project structure

2010-09-16 Thread David Aldrich
Thanks Michael

David

 -Original Message-
 From: Michael Wild [mailto:them...@gmail.com]
 Sent: 16 September 2010 12:21
 To: David Aldrich
 Cc: David Cole; cmake@cmake.org
 Subject: Re: [CMake] Question regarding project structure
 
 
 On 16. Sep, 2010, at 13:14 , David Aldrich wrote:
 
  Hi David
 
  Thanks very much - I will give that a try. By the way, we are building
 on Linux only.
 
  If I specify compiler flags in my top level CMakeLists file, I guess
 that the lower level ones will inherit those settings and store them in
 their local caches. Then a lower level CMake may be performed manually and
 still inherit those settings. But this would require the top-level
 CMakeLists file to have been executed at some point previously. Am I
 correct?
 
 Only the top-level project generates a cache.
 
 
  We store our code in svn. Followiing a clean checkout of the code, is
 there a way that I can ensure that a developer has executed the top level
 makefile before attempting to invoke individual library makefiles, so that
 he can be sure that he has the correct compiler flags?
 
 Don't put a project command in the library CMakeLists.txt files then, so
 they are unusable on their own.
 
 
  (We achieved this previously by including a top-level settings file in
 each makefile).
 
  Best regards
 
  David
 
 HTH
 
 Michael
 
 
  From: David Cole [mailto:david.c...@kitware.com]
  Sent: 16 September 2010 11:58
  To: David Aldrich
  Cc: cmake@cmake.org
  Subject: Re: [CMake] Question regarding project structure
 
  On Thu, Sep 16, 2010 at 6:45 AM, David Aldrich
 david.aldr...@eu.nec.commailto:david.aldr...@eu.nec.com wrote:
  Hi
 
  I have now successfully configured CMakeLists files to create some of
 our static and dynamic libraries using CMake.  I would now like some
 advice on how to configure these separate build files as a single project.
 
  Here's what our current folder structure is like:
 
  Trunk --- Kernel   a static library containing main()
 |
 |--- DynLibs  containg multiple folders containing
 |  proprietary source code, each folder
 |  builds one shared library
 |
 |--- MyExe    contains top-level makefile that
a) links Kernel static library into
 an .exe
b) calls makefiles for the dynamic
  libraries
 
  This structure may not be ideal from a CMake standpoint, but I would
 like to maintain it to ease the transition from pure gnu make to CMake.
 
  CMake is flexible about where source files are located. This structure
 looks perfectly reasonable.
 
 
  What would I need to put in the top-level CMakeLists file
 (MyExe/CMakeLists.txt) to reference the other CMakeLists files?
 
  Something like this should work:
 
  cmake_minimum_required(VERSION 2.8)
  project(MyExe)
 
  add_subdirectory(../Kernel Kernel)
  add_subdirectory(../DynLibs DynLibs)
 
  add_executable(MyExe exe.cxx)
  target_link_libraries(MyExe Kernel)
 
 
  If your DynLibs build dll files on Windows, the easiest way to get
  them to load into the exe is to use the RUNTIME_OUTPUT_DIRECTORY
  target property. (Just put the exe and the dlls all in the same folder
  with each other...)
  http://www.cmake.org/cmake/help/cmake-2-8-docs.html#prop_tgt:RUNTIME_O
  UTPUT_DIRECTORY
 
  Or just once in your top level CMakeLists, the
 CMAKE_RUNTIME_OUTPUT_DIRECTORY variable:
  http://www.cmake.org/cmake/help/cmake-2-8-docs.html#variable:CMAKE_RUN
  TIME_OUTPUT_DIRECTORY
 
 
 
  Should each CMakeLists file have its own Project name, or should they
 all be the same?
 
  Only the top one *needs* a project command, but if you do have project
 commands in your other CMakeLists.txt files, they should definitely each
 be unique.
 
 
  Any advice would be much appreciated.
 
  Best regards
 
  David
  ___
  Powered by www.kitware.comhttp://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
 
 
  HTH,
  David C.
 
 
 
  Click
 herehttps://www.mailcontrol.com/sr/NU6aVxvGVgvTndxI!oX7Uv3k+FkN6HRUneeEXa
 JdAcTHag+0Uqgm21LO1pIkrfrEk+T08o1InrG6Rmyxrg+4Pw== to report this email
 as spam.
  ___
  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
 
 --
 There is always a well-known solution to every human problem -- neat,
 plausible, and wrong.
 H. L. Mencken

Re: [CMake] Question regarding project structure

2010-09-16 Thread David Aldrich
Hi David

 Something like this should work:

 cmake_minimum_required(VERSION 2.8)
 project(MyExe)

 add_subdirectory(../Kernel Kernel)
 add_subdirectory(../DynLibs DynLibs)

 add_executable(MyExe exe.cxx)
 target_link_libraries(MyExe Kernel)

I have a problem with add_executable(). Our Kernel library includes main.cpp, 
so all our existing linker command does is to take libKernel.a and make it an 
executable:

g++ -o _gnuRelease/MyExe -ldl -Wl,-whole-archive,-export-dynamic 
../Kernel/_gnuRelease/libKernel.a

So I have no source files to specify. Does 'exe.cxx' (above) have special 
properties or is it just a placeholder? If the latter, how can I build an 
executable with no source files specified?

BR

David

___
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] Question regarding project structure

2010-09-16 Thread David Aldrich
Hi Michael and David
 
 True, but some people hate that; We've had this discussion already on this
 list where somebody seemed to be honestly offended by the mere notion of
 an empty dummy file.

I think I can tolerate it ;-)

Thanks for your help.

David

___
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] Use of CMAKE_LIBRARY_OUTPUT_DIRECTORY

2010-09-14 Thread David Aldrich
Hi Ryan

 I believe for static libraries, the variable
 CMAKE_ARCHIVE_OUTPUT_DIRECTORY
 is actually used.  

Thanks for your answer. That's just what I need.

Best regards

David
___
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] Question about add_custom_command

2010-09-13 Thread David Aldrich
Hi Michael

 set(SRCS a.c b.c d.c e.c)
 
 add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/f.c
   COMMAND ...
   DEPENDS ${SRCS}
   COMMENT Generating f.c
   VERBATIM)
 list(APPEND SRCS ${CMAKE_BINARY_DIR}/f.c)
 
 add_executable(main ${SRCS})

Thanks - that worked nicely.

Now I have another problem. I need to link to the Python libraries. So I 
specify:

FIND_PACKAGE(PythonLibs REQUIRED)
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})

snip

message (${PYTHON_LIBRARY})
add_library( Kernel STATIC ${SRCS} )
TARGET_LINK_LIBRARIES(Kernel ${PYTHON_LIBRARY})

The message shows:

/usr/lib64/libpython2.4.so

but this path does not appear in the link command so the build fails.

I am trying to build a static library so am worried why ${PYTHON_LIBRARY} is a 
shared library.

By the way, is it normal CMake style to write CMAKE commands in upper or lower 
case?

Can you help with these questions please?

BR

David
___
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] Question about add_custom_command

2010-09-13 Thread David Aldrich
Hi Michael

 
 You never link static libraries. They are more like zip files than actual
 libraries and just contain the compiled object files and for if you ran
 ranlib on it, also a table-of-contents to speed link up.
 
 If you do target_link_libraries in CMake, where the target is a static
 library, CMake just creates the static library archive and remembers
 internally the transitive link dependency. If you linked that static
 archive into an executable, the python libraries would then show up on the
 command line.

Now I am confused (more than before!) because linking my Kernel library does 
give errors related to Python:

Linking CXX executable main
CMakeFiles/main.dir/Kernel.cpp.o: In function 
`__static_initialization_and_destruction_0(int, int)':
Kernel.cpp:(.text+0x101): undefined reference to `_Py_NoneStruct'
Kernel.cpp:(.text+0x10d): undefined reference to `_Py_NoneStruct'

The make file is evidently building an executable even though I have only 
specified:

add_library( Kernel STATIC ${SRCS} )

I can see from make VERBOSE=1, that it is trying to link main.exe instead of 
calling 'ar' to build libKernel.a.

Can you give me some more help on this please?

David
___
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] Question about add_custom_command

2010-09-13 Thread David Aldrich
Hi Michael

I have found that I had an 'add_executable' call left in accidentally. 

Sorry for wasting your time. It works well now. Thanks again for your help.

BR

David

___
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] Question about add_custom_command

2010-09-10 Thread David Aldrich
Hi Michael

Thanks for your help. Please see question below.

 CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)
 PROJECT(GENDEP C)
 FILE(WRITE ${CMAKE_BINARY_DIR}/g.c void g(void){}\n)
 ADD_CUSTOM_COMMAND(
 OUTPUT ${CMAKE_BINARY_DIR}/f.c
 COMMAND echo void f(void){}  ${CMAKE_BINARY_DIR}/f.c
 DEPENDS ${CMAKE_BINARY_DIR}/g.c
 VERBATIM)
 FILE(WRITE ${CMAKE_BINARY_DIR}/main.c int main(void){f();return 0;}\n)
 ADD_EXECUTABLE(main main.c f.c)
 
 f.c is regenerated and, thus, main rebuilt if g.c is touched
 although it's not incorporated in main. 

In my case, the dependencies of the f.c will be all the dependencies of main. 
i.e. if any source file contributing to the exe changes we must first 
regenerate f.c.

Now our executable depends on many source files. I assume you are saying that I 
need to add the same list of dependencies to the ADD_CUSTOM_COMMAND. Can I 
specify a list of files further up in CMakeLists.txt so that I only need to 
enumerate the list once?

Regards

David
___
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] Question about add_custom_command

2010-09-10 Thread David Aldrich
That's great. Thanks for your patience!

David

 -Original Message-
 From: cmake-boun...@cmake.org [mailto:cmake-boun...@cmake.org] On Behalf
 Of Michael Wild
 Sent: 10 September 2010 12:30
 To: David Aldrich
 Cc: cmake@cmake.org
 Subject: Re: [CMake] Question about add_custom_command
 
 
 On 10. Sep, 2010, at 12:38 , David Aldrich wrote:
 
  Hi Michael
 
  Thanks for your help. Please see question below.
 
  CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR) PROJECT(GENDEP C)
  FILE(WRITE ${CMAKE_BINARY_DIR}/g.c void g(void){}\n)
  ADD_CUSTOM_COMMAND(
 OUTPUT ${CMAKE_BINARY_DIR}/f.c
 COMMAND echo void f(void){}  ${CMAKE_BINARY_DIR}/f.c
 DEPENDS ${CMAKE_BINARY_DIR}/g.c
 VERBATIM)
  FILE(WRITE ${CMAKE_BINARY_DIR}/main.c int main(void){f();return
  0;}\n) ADD_EXECUTABLE(main main.c f.c)
 
  f.c is regenerated and, thus, main rebuilt if g.c is touched
  although it's not incorporated in main.
 
  In my case, the dependencies of the f.c will be all the dependencies of
 main. i.e. if any source file contributing to the exe changes we must
 first regenerate f.c.
 
  Now our executable depends on many source files. I assume you are saying
 that I need to add the same list of dependencies to the ADD_CUSTOM_COMMAND.
 Can I specify a list of files further up in CMakeLists.txt so that I only
 need to enumerate the list once?
 
  Regards
 
  David
 
 set(SRCS a.c b.c d.c e.c)
 
 add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/f.c
   COMMAND ...
   DEPENDS ${SRCS}
   COMMENT Generating f.c
   VERBATIM)
 list(APPEND SRCS ${CMAKE_BINARY_DIR}/f.c)
 
 add_executable(main ${SRCS})
 
 
 HTH
 
 Michael
 
 --
 There is always a well-known solution to every human problem -- neat,
 plausible, and wrong.
 H. L. Mencken

___
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] Newbie questions: verbosity and compiler invocation

2010-09-09 Thread David Aldrich
Hi Michael

The makefile I am replacing uses VPATH to specify a source file that must be 
compiled for the target.

That source file is in a different directory to the one containing 
CMakeLists.txt.

How can I achieve this with CMake please?

Best regards

David

___
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] Newbie questions: verbosity and compiler invocation

2010-09-09 Thread David Aldrich
Hi Michael
 
 With CMake you can use absolute and relative paths, no problem. If you use
 absolute paths, please use one of the pre-defined variables, such as
 ${CMAKE_SOURCE_DIR}, ${CMAKE_BINARY_DIR}, ${CMAKE_CURRENT_SOURCE_DIR}
 ${CMAKE_CURRENT_BINARY_DIR} ${PROJECT_SOURCE_DIR}, ${PROJECT_BINARY_DIR},
 ${project_name_SOURCE_DIR} or ${project_name_BINARY_DIR}.

Thanks. My situation is:

  -- FolderA --- CMakeLists.txt
  |
  |- FolderB --- ErrorHandler.cpp

As FolderB is not beneath FolderA, I don't know how to specify 
FolderB/ErrorHandler.cpp in CMakeLists.txt using CMAKE_CURRENT_SOURCE_DIR. Do I 
need to set PROJECT_SOURCE_DIR to the parent folder of A and B?

Can you suggest how I can do this please?

Best regards

David
___
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] Newbie questions: verbosity and compiler invocation

2010-09-09 Thread David Aldrich
Hi Michael

 Are they _always_ next to each other and is FolderB always called by that
 name? 

Yes

 If so, just do ${CMAKE_PROJECT_DIR}/../FolderB.

Thanks that worked fine. I wasn't aware of that syntax possibility.

David

___
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] Question about add_custom_command

2010-09-09 Thread David Aldrich
Hi 

As mentioned before, I am replacing a manually built gnu makefile (for Linux) 
that builds a library, with CMake.

A required build step is to run an executable called versionInfo that processes 
all the source files of the library and generates a new source file called 
SourceFileInfo.cpp. This generated file must be compiled and added to the 
library. This step must be executed when any library dependency changes (i.e. 
any other source file changes).

I tried:

add_custom_command (
  TARGET Kernel
  PRE_BUILD
  COMMAND ${CMAKE_SOURCE_DIR}/../VersionInfo/versionInfo ${CMAKE_SOURCE_DIR} 
KERNEL
  [COMMENT Building SourceFileInfo.cpp]
  )

add_library(Kernel STATIC
ErrorHandler.cpp
EnvVars.cpp
SourceFileInfo.cpp
snip
)

The source files are compiled ok, but versionInfo does not run and, because 
SourceFileInfo.cpp is therefore not found, the script fails.

Am I on the right track?

I read that PRE_BUILD is only supported for Visual Studio 7 or later, but I got 
no better result with PRE_LINK.
 
Best regards

David
___
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] Newbie questions: verbosity and compiler invocation

2010-09-08 Thread David Aldrich
Hi

I am experimenting with using CMake to replace our manually written gnu 
makefiles on Linux. I have a couple of questions:

1) VERBOSITY

I would like to see the compiler command on the console when running make. I 
know that one can run:

make VERBOSE=1

but that displays a lot of detail, for example:

make[1]: Entering directory ...

Is there a way that I reduce the commentary to just show the compiler commands? 
For example:

/usr/bin/c++ -o CMakeFiles/Kernel.dir/ErrorHandler.cpp.o -c 
/mypath/Kernel/ErrorHandler.cpp

2) COMPILER

As shown above, cmake is invoking:

/usr/bin/c++ 

I don't know what this tool is.  How can I specify to use /usr/bin/g++ ?

Best regards

David
___
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] Newbie questions: verbosity and compiler invocation

2010-09-08 Thread David Aldrich
Hi Michael

Thanks for your answers.

One other thing was worrying me. Currently, if a user changes our manually 
written makefile and checks it into svn, other users can do an svn update and 
then invoke make to construct a new build. 

If we move to cmake, users would modify and commit CMakeLists.txt. I was 
worried that they would then need to run cmake followed by make. They might 
forget to do both. But it seems that 'make' compares the timestamp of the 
generated makefile against that of CMakeLists.txt and rebuilds the makefile if 
it is older.  Therefore, the developer would not need to run cmake, just 
'make'. Am I correct?

I guess the only new action in the workflow would be that a complete cmake 
command must be invoked on a freshly checked out working copy, if the build 
tree is in that working copy.  Am I correct?

Thanks

David

 -Original Message-
 From: Michael Wild [mailto:them...@gmail.com]
 Sent: 08 September 2010 15:56
 To: David Aldrich
 Cc: CMake@cmake.org
 Subject: Re: [CMake] Newbie questions: verbosity and compiler invocation
 
 
 On 8. Sep, 2010, at 16:33 , David Aldrich wrote:
 
  Hi
 
  I am experimenting with using CMake to replace our manually written gnu
 makefiles on Linux. I have a couple of questions:
 
  1) VERBOSITY
 
  I would like to see the compiler command on the console when running
 make. I know that one can run:
 
  make VERBOSE=1
 
  but that displays a lot of detail, for example:
 
  make[1]: Entering directory ...
 
  Is there a way that I reduce the commentary to just show the compiler
 commands? For example:
 
  /usr/bin/c++ -o CMakeFiles/Kernel.dir/ErrorHandler.cpp.o -c
 /mypath/Kernel/ErrorHandler.cpp
 
 AFAIK there's no way to do that (apart from writing a wrapper script which
 echoes the command to stdout and then invokes it).
 
 
  2) COMPILER
 
  As shown above, cmake is invoking:
 
  /usr/bin/c++
 
  I don't know what this tool is.  How can I specify to use /usr/bin/g++ ?
 
  Best regards
 
  David
 
 The first time you invoke CMake, do it like this:
 
 CC=/usr/bin/gcc CXX=/usr/bin/g++ cmake /path/to/source
 
 Alternatively, you can pass -DCMAKE_C_COMPILER=/usr/bin/gcc to the cmake
 program (similarly CMAKE_CXX_COMPILER for the c++ compiler), but that can
 have some nasty side-effects (e.g deleting and rebuilding the whole cache
 if it already exists).
 
 Usually, on Linux systems, /usr/bin/c++ is just another name for
 /usr/bin/g++. It is traditional to call the default C++ compiler
 /usr/bin/c++, such that hand-crafted Makefiles don't have to guess a name.
 Similarly, /usr/bin/cc is the default C compiler.
 
 Hope this clears things up a bit for you
 
 Michael
 
 --
 There is always a well-known solution to every human problem -- neat,
 plausible, and wrong.
 H. L. Mencken

___
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] Newbie questions: verbosity and compiler invocation

2010-09-08 Thread David Aldrich
Hi Michael

 Yes, this is correct. 

Thanks.

 And before you even get the idea: Never add the
 CMake-generated files (Makefile, CMakeCache.txt, etc.) to your version
 control system. They are not relocatable.

Ah yes. You told me that before ;-)  I will take your advice!

David
___
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] Complete beginner question about tutorial

2010-09-07 Thread David Aldrich
Hi 

I want to run the CMake tutorial 
(http://www.cmake.org/cmake/help/cmake_tutorial.html).

The tutorial appears not to show the CMake commands necessary to build program. 
On Windows what command should I use to build the Tutorial executable with 
Visual C++ 2008?

Best regards

David

___
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] Complete beginner question about tutorial

2010-09-07 Thread David Aldrich
Hi Eike and Arjen

Thanks for your answers. Sorry for my trivial question!

I would like to ask a question about best practice. I think that, initially, we 
would use CMake only on Linux, to replace our hardcoded of gnu makefiles (we 
don't use autotools). So only one platform is involved. I am wondering what to 
put under version control. Would it be best to version control only 
CMakeLists.txt and let each developer separately run CMake and then make? Or 
should the modifier of CMakeLists.txt be responsible for running CMake and 
check-in the generated Makefile, so that the user only needs to update his 
(svn) working copy and run make?

Best regards

David

 -Original Message-
 From: cmake-boun...@cmake.org [mailto:cmake-boun...@cmake.org] On Behalf
 Of Rolf Eike Beer
 Sent: 07 September 2010 13:11
 To: cmake@cmake.org
 Subject: Re: [CMake] Complete beginner question about tutorial
 
 Am Tuesday 07 September 2010 schrieb David Aldrich:
  Hi
 
  I want to run the CMake tutorial
  (http://www.cmake.org/cmake/help/cmake_tutorial.html).
 
  The tutorial appears not to show the CMake commands necessary to build
  program. On Windows what command should I use to build the Tutorial
  executable with Visual C++ 2008?
 
 You should create the programs with '-G Visual Studio 9 2008' to get a
 MSVC solution file. Load that one and just let it build.
 
 You could open a compiler console (Start - Programs - Microsoft Visual
 Studio 2008 - Tools - x86 command prompt (or something like that)) and
 use '-G NMake Makefiles'. Then you would run nmake from that command
 window to build. You need to run cmake in that window or it will not be
 able to detect the proper compiler settings for nmake otherwise.
 
 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] Complete beginner question about tutorial

2010-09-07 Thread David Aldrich
Hi Michael

Thanks for making that clear.

David


From: Michael Wild [them...@gmail.com]
Sent: 07 September 2010 15:40
To: Arjen Markus
Cc: David Aldrich; CMake@cmake.org
Subject: Re: [CMake] Complete beginner question about tutorial

Never EVER put CMake generated files in version control. They are not 
relocatable.

Michael

On 7. Sep, 2010, at 16:06 , Arjen Markus wrote:

 Hi David,

 I would say put the CMakeLists.txt files under version control.
 This is what we do within the PLplot project and that is what I
 generally see: generated files are not managed, as you can always
 generate them again.

 (For convenience you can put them in version control, for instance,
 to get people started rightaway. But then if they need to add a
 file or change compile options, they will have to use CMake again.
 If running CMake - or any other tool that generates files - is
 problematic, then putting such files in the distribution is
 one way out again.)

 Regards,

 Arjen

 On 2010-09-07 15:24, David Aldrich wrote:
 Hi Eike and Arjen
 Thanks for your answers. Sorry for my trivial question!
 I would like to ask a question about best practice. I think that, initially, 
 we would use CMake only on Linux, to replace our hardcoded of gnu makefiles 
 (we don't use autotools). So only one platform is involved. I am wondering 
 what to put under version control. Would it be best to version control only 
 CMakeLists.txt and let each developer separately run CMake and then make? Or 
 should the modifier of CMakeLists.txt be responsible for running CMake and 
 check-in the generated Makefile, so that the user only needs to update his 
 (svn) working copy and run make?
 Best regards
 David
 -Original Message-
 From: cmake-boun...@cmake.org [mailto:cmake-boun...@cmake.org] On Behalf
 Of Rolf Eike Beer
 Sent: 07 September 2010 13:11
 To: cmake@cmake.org
 Subject: Re: [CMake] Complete beginner question about tutorial

 Am Tuesday 07 September 2010 schrieb David Aldrich:
 Hi

 I want to run the CMake tutorial
 (http://www.cmake.org/cmake/help/cmake_tutorial.html).

 The tutorial appears not to show the CMake commands necessary to build
 program. On Windows what command should I use to build the Tutorial
 executable with Visual C++ 2008?
 You should create the programs with '-G Visual Studio 9 2008' to get a
 MSVC solution file. Load that one and just let it build.

 You could open a compiler console (Start - Programs - Microsoft Visual
 Studio 2008 - Tools - x86 command prompt (or something like that)) and
 use '-G NMake Makefiles'. Then you would run nmake from that command
 window to build. You need to run cmake in that window or it will not be
 able to detect the proper compiler settings for nmake otherwise.

 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

 DISCLAIMER: This message is intended exclusively for the addressee(s) and may 
 contain confidential and privileged information. If you are not the intended 
 recipient please notify the sender immediately and destroy this message. 
 Unauthorized use, disclosure or copying of this message is strictly 
 prohibited.
 The foundation 'Stichting Deltares', which has its seat at Delft, The 
 Netherlands, Commercial Registration Number 41146461, is not liable in any 
 way whatsoever for consequences and/or damages resulting from the improper, 
 incomplete and untimely dispatch, receipt and/or content of this e-mail.




 ___
 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

--
There is always a well-known solution to every human problem -- neat, 
plausible, and wrong.
H. L. Mencken
___
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] Newbie question: cmake does not have nmake generator

2009-09-10 Thread David Aldrich
Hi 

 Any idea why this is happening please?

Sorry, I should have thought a little more. I deleted the contents of 
buildnmake and now CMake succeeds.

I then executed:

C:\plplot-5.9.5\buildnmakepath=...\plplot-5.9.5\buildnmake\dll;%PATH%
C:\plplot-5.9.5\buildnmakenmake

and the nmake output terminates with:

[ 87%] Building C object drivers/CMakeFiles/xfig.dir/xfig.c.obj
xfig.c
Linking C shared module ..\dll\xfig.dll
   Creating library ..\dll\xfig.lib and object ..\dll\xfig.exp
   Creating library ..\dll\xfig.lib and object ..\dll\xfig.exp
[ 87%] Built target xfig
Scanning dependencies of target test_dyndrivers
[ 87%] Generating test_dyndrivers_dir/mem.rc
NMAKE : fatal error U1077: '.\test-drv-info.exe' : return code '0xc135'
Stop.
NMAKE : fatal error U1077: 'C:\Program Files\Microsoft Visual Studio 
8\VC\BIN\nmake.exe' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'C:\Program Files\Microsoft Visual Studio 
8\VC\BIN\nmake.exe' : return code '0x2'
Stop.

Any ideas on this one please? I started from the Visual Studio 2005 command 
line interface, but Visual Studio 8 nmake has been invoked. I wonder if that is 
causing the problem?

Best regards

David
___
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] Newbie question: cmake does not have nmake generator

2009-09-10 Thread David Aldrich
Hi Bill and Alan

Thank you both very much for answering my question. I did indeed have an old 
version of CMake, from a forgotten installation of Cygwin, and that was being 
invoked. I have now deleted that old CMake (and hopefully Cygwin as well) and 
am now truly running 2.6.4. 

C:\plplot-5.9.5\buildnmakecmake --help
cmake version 2.6-patch 4
[snip]

However, I have now hit another problem:

C:\plplot-5.9.5\buildnmakecmake -G NMake Makefiles 
-DCMAKE_INSTALL_PREFIX=install ..
CMake Error: The source C:/plplot-5.9.5/CMakeLists.txt does not match the 
source /cygdrive/c/plplot-5.9.5/CMakeLists.
txt used to generate cache.  Re-run cmake with a different source directory.

Any idea why this is happening please? Is the mention of 'cygdrive' worrying?

Best regards

David
___
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] Newbie question: cmake does not have nmake generator

2009-09-10 Thread David Aldrich
Hi Arjen

 you should start cmake in a clean directory - old stuff might get in the
 way otherwise, as a lot of information is being cached.

Yes, that was the problem. Thanks.

As I wrote in another mail this morning (the order seems to have got reversed) 
CMake now succeeds but nmake fails:

[ 87%] Generating test_dyndrivers_dir/null.rc
NMAKE : fatal error U1077: '.\test-drv-info.exe' : return code '0xc135'
Stop.
NMAKE : fatal error U1077: 'C:\Program Files\Microsoft Visual Studio 
8\VC\BIN\nmake.exe' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'C:\Program Files\Microsoft Visual Studio 
8\VC\BIN\nmake.exe' : return code '0x2'
Stop.

I am wondering whether this is to do with the dll path, but my path does start 
with:

PATH=..\..\plplot-5.9.5\buildnmake\dll;

Best regards

David
___
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] Newbie question: cmake does not have nmake generator

2009-09-10 Thread David Aldrich
Hi Arjen

 this is PLplot-specific, has nothing (or at least very little) to do
 with CMake. The problem is that the program that creates these driver
 files needs a few DLLs and they are not yet in the DLL subdirectory.

Sorry, I will try your suggestion and move back to the PLplot mail list.

Best regards

David
___
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] Newbie question: cmake does not have nmake generator

2009-09-09 Thread David Aldrich
Hi

I am new to cmake. I have installed cmake (using cmake-2.6.4-win32-x86.exe) on 
my Win XP platform, on which I also have Visual Studio 2005 Prof and Visual 
Studio 2008 Express installed.

I am trying to build PLplot, whose instructions tell me to run:

cmake -G NMake Makefiles -DCMAKE_INSTALL_PREFIX=install ..

but I get:

CMake Error: Could not create named generator
-- Check for working C compiler: gcc
-- Check for working C compiler: gcc -- broken
The C compiler gcc is not able to compile a simple test program.

It appears that cmake only knows about the unix generator:

C:\plplot-5.9.5\buildnmakecmake --help
 [snip]
The following generators are available on this platform:
  Unix Makefiles  = Generates standard UNIX makefiles.

I have run Visual Studio file vcvars32.bat

How can I install the nmake and Visual Studio 8 generators please?

Best regards
David

___
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] Newbie question: cmake does not have nmake generator

2009-09-09 Thread David Aldrich
Hi

I am new to cmake. I have installed cmake (using cmake-2.6.4-win32-x86.exe) on 
my Win XP platform, on which I also have Visual Studio 2005 Prof and Visual 
Studio 2008 Express installed.

I am trying to build PLplot, whose instructions tell me to run:

cmake -G NMake Makefiles -DCMAKE_INSTALL_PREFIX=install ..

but I get:

CMake Error: Could not create named generator
-- Check for working C compiler: gcc
-- Check for working C compiler: gcc -- broken
The C compiler gcc is not able to compile a simple test program.

It appears that cmake only knows about the unix generator:

C:\plplot-5.9.5\buildnmakecmake --help
 [snip]
The following generators are available on this platform:
  Unix Makefiles  = Generates standard UNIX makefiles.

I have run Visual Studio file vcvars32.bat

How can I install the nmake and Visual Studio 8 generators please?

Best regards
David

___
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