Re: [CMake] Cmake inline macro?

2007-09-15 Thread Jack Kelly

Dizzy wrote:

I couldn't find one, so I ported AC_C_INLINE to CMake. Since there's no
equivalent of autoheader to make the config.h.in, I just used
ADD_DEFINITIONS.


There is such a thing, you use configure_file() to replace variables from 
a config.h.in (tho I name them usually config.h.cmake) or #cmakedefine 
placeholders. See the cmake man page on CONFIGURE_FILE.


Create a config.h.cmake with the following contents:
#define inline ${INLINE_KEYWORD}

Use it with configure_file(config.h.cmake config.h) and make sure you 
include config.h in your code.


That is of couse assuming that the variable holding the inline keyword (or  
if there is no inline supported) is named INLINE_KEYWORD. Many macros output 
their result into a user given variable so it fits well in the cmake style.


You misunderstand me. autoheader can create the config.h.in based on the 
calls made in the configure.ac file whereas CMake has to manually 
specify a file to be used for CONFIGURE_FILE.


-- Jack
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Fltk project, visual studio 2005 (8) -- using FL/Fl.H

2007-09-13 Thread Jack Kelly

Atwood, Robert C wrote:

FLTK_INCLUDE_DIR  C:/Program Files/FLTK/include/FL
In Cmake


Should be

C:/Program Files/FLTK/include

I think.

-- Jack
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] What is required to run CMake with Unix Makefile option on windows?

2007-09-13 Thread Jack Kelly

Tal Blum wrote:
I get the following error: CMAKE_MAKE_PROGRAM is not set. You probably 
need to set a different build tool.


Looking at http://www.vtk.org/Wiki/CMake_Generator_Specific_Information 
suggests that CMake can't find cygwin's make program. Did you install it?


-- Jack
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Project being (unnecessarily) relinked

2007-09-12 Thread Jack Kelly

Jesper Eskilson wrote

Well, that turned out to be a little hasty conclusion.

In case of linking with a DLL, having paths to both the dll and import 
lib in LINK_DIRECTORIES avoids relinking. So far, so good.


However, I still get relinks due to a dependency on a static library. In 
this case, I'm unable to add the path using LINK_DIRECTORIES since the 
path is different depending on the configuration. I'm currently adding 
the path using the LINK_FLAGS_{DEBUG, ...} target property (which 
probably is the cause of the relinking).


So, I would like to be able to do something like, given the debug 
version of MyStaticLib.lib is in lib/win32/debug:


LINK_DIRECTORIES_DEBUG(lib/win32/debug)
TARGET_LINK_LIBRARIES(Foo MyStaticLib)

To make things more difficult, I cannot do something like:

LINK_DIRECTORIES(lib/win32/$(ConfigurationName))

because the configurations available for the static library 
(MyStaticLib.lib) do not map cleanly on the values for 
$(ConfigurationName).


Is there any reason why

IF(${CMAKE_BUILD_TYPE} STREQUAL Debug)
  LINK_DIRECTORIES(/path/to/debug/lib)
ELSE(${CMAKE_BUILD_TYPE} STREQUAL Debug)
  LINK_DIRECTORIES(/path/to/release/lib)
ENDIF(${CMAKE_BUILD_TYPE} STREQUAL Debug)

won't work for you?

-- Jack
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Project being (unnecessarily) relinked

2007-09-05 Thread Jack Kelly

Mathieu Malaterre wrote:

On 9/4/07, Jesper Eskilson [EMAIL PROTECTED] wrote:

Hi!

I've got a Visual Studio 8 solution generated by CMake where one of the
projects is always being relinked everytime I build it, even when
nothing in it has changed (i.e. if I try to build it twice, it always
relinks the project the second time).

I've studied the build logs, but they do not make me any wiser.

Does anyone recognize this behavior?


Could it be something to do with RPATH? Try building with 
CMAKE_SKIP_RPATH ON set in the cache. My guess would be that because you 
don't know where all the libs are until install time, you have to do a 
relink to ensure that the RPATH is being set correctly.


(Someone please correct me if I'm wrong.)

-- Jack
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Newbie question, building the exe to a directory

2007-09-02 Thread Jack Kelly

Pingu wrote:
All I'm asking for is a way to tell the compiler (VS8) to build the exe 
in a certain folder as opposed to the build folder where the project 
files are located. It really doesn't seem like it'd be that hard, but I 
really don't understand CMake all that well right now.


You should be able to do this by overriding EXECUTABLE_OUTPUT_PATH. Have 
 a look at http://www.cmake.org/Wiki/CMake_Useful_Variables .


-- Jack
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Feature request

2007-08-31 Thread Jack Kelly

Matthew Smith wrote:
I'd like to ask if there is a CMake variable for the version of Qt that 
is present in a project?  I've looked in my cache file and have never 
found one, even though the version number is displayed at configure 
stage when compiling the project.


Hi Matthew,

FindQt.cmake in the default installation (for me, anyway. CMake 2.4.7) 
will set QT4_INSTALLED to TRUE if Qt4 is found and similarly for 
QT3_INSTALLED, but they aren't cache variables.


Will they do what you want?

-- Jack
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Turning on warnings when compiling.

2007-08-28 Thread Jack Kelly

Michael Wagner wrote:

Maybe somebody out there knows how to turn on warnings. (Hopefully you
are not all fearless coders that laugh in the face of warnings... ;-)


Real Programmers(tm) don't need warnings!

For mortals like myself, here's how I do it:

Go into the CMake cache via `make edit_cache', `ccmake .' or similar 
from your build directory.


Depending on the value of CMAKE_BUILD_TYPE and the language you're 
using, the variable you'll need to set will be different:


For C, you have CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE} (but in uppercase), so
CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_MINSIZEREL
... and so on

You could also lock down required flags by SETting the variables in 
CMakeLists.txt if you wanted.


-- Jack
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Programs linked to .a or .so libraries?

2007-08-28 Thread Jack Kelly

Hendrik Sattler wrote:
But it's also a security nightmare: you cannot just update the lib, you also 
have to relink the program.


Another reason: you can't statically link against GNU LGPL code without 
getting into a huge mess of sending out half-linked binaries so that 
users still have the freedom to modify the LGPL part of the code and 
link it against your static work.


(I know that the OP wasn't talking about LGPL code, but I thought I'd 
throw it out there as a reason why I don't think it's so great an idea)


-- Jack
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] INSTALL(NEW_DIRECTORY...) ?

2007-08-24 Thread Jack Kelly

Dizzy wrote:
On install I would need cmake to portably create some empty directories that 
do not exist in the source. INSTALL(DIRECTORY...) just copies an existent 
structure in my case that structure does not exists. I know I could probably 
search for some external mkdir command and use it but then I would have to 
think of any possible platform and try to find the command for that platform 
and also worry about whatever parameters it wants. cmake already has logic to 
create directories in a platform independent way used by the various 
INSTALL(...) commands, it would be nice if there was a way to use it to 
create some arbitrary directories on install (their path of course it still 
respects CMAKE_INSTALL_PREFIX and such).


To solve this in automake I just created some dummy stuff_dir variables 
that automake interpreted and created those empty directories on install. I 
would like to know if there is something similar for cmake, thank you!



You could try assembling the empty directory structure with

FILE(MAKE_DIRECTORY ${foo_BINARY_DIR}/path)

and install that.

-- Jack
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] installation of properly line ended text files

2007-08-24 Thread Jack Kelly

Dizzy wrote:
Thanks for the idea. I could use as a workarround configure_file() in some way 
or another but then I still need one more issue solved. How to 
escape ${variable} strings in a input to configure_file() so that it 
doesn't try to do variable replacement on the placeholder? (this should be a 
general available feature, people would probably need to escape variable 
placeholders in other situations than mine). Example: I had an almost similar 
problem where ${variable} from the Makefile were replaced by their value by 
the running make but I didnt wanted to so I had to use $${variable}. Is 
there something similar?


You shouldn't have to do any escaping. Use

CONFIGURE_FILE(${SOURCEFILE} ${DESTFILE} COPYONLY)

-- Jack

___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] always execute CUSTOM_COMMAND

2007-08-21 Thread Jack Kelly

[EMAIL PROTECTED] wrote:

PROJECT ( test_project )
ADD_CUSTOM_COMMAND (
OUTPUT file.txt
COMMAND cp /etc/passwd file.txt
)
ADD_CUSTOM_TARGET ( file_target DEPENDS file.txt )
INSTALL ( FILES file.txt DESTINATION /tmp )

I need to create file file.txt and install it. But installation doesn't 
affect dependency, so file.txt will never be created. That file isn't c code, 
so it can't be included to any executable or library to create dependency.


What is the right syntax to create and install that file, please?

You were pretty close. You only really missed 2 things:

1. The `ALL' option in ADD_CUSTOM_TARGET. In the CMake docs for 
ADD_CUSTOM_TARGET:


  If the ALL option is specified it indicates  that  this
  target  should  be  added to the default build target so that it
  will be run every time (the command cannot be called  ALL).

2. INSTALL should probably have a specific path to your generated file. 
CMake didn't pick up on it unless I gave a more specific path.


3. ADD_CUSTOM_TARGET can contain embedded commands.

Here's a CMakeLists.txt that I used:

PROJECT(test NONE)
ADD_CUSTOM_TARGET(
  file.txt ALL
  COMMAND touch ARGS file.txt
  VERBATIM
)
INSTALL(
  FILES ${CMAKE_BINARY_DIR}/file.txt
  DESTINATION /tmp
)

-- Jack
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Running cmake to create binaries on a VFAT partition (LINUX)

2007-08-18 Thread Jack Kelly

Clemens Arth wrote:

/media/data vfatdefaults,utf8,umask=007,gid=46  0   1


I'm not 100% on how umask works, but I think that:

Using the user account that you tried to run CMake with, attempt to 
create a file in the vfat mount, just to confirm it's a permission issue.


-- Jack
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


[CMake] Supporting languages where compilation of one file produces multiple files

2007-08-18 Thread Jack Kelly

Hi all,

I'm specifically thinking about OCaml here, but the problem generalises 
to other languages where the compiler doesn't output exactly one file. 
If I compile a .ml file using the native code compiler:


$ ocamlopt -c -o foo.cmx foo.ml

It will also produce a .o file and possibly a .cmi file (if an explicit 
interface file foo.mli was not present)


I guess the rule for CMAKE_OCaml_COMPILE_OBJECT would be
CMAKE_OCaml_COMPILER FLAGS -c -o OBJECT SOURCE
but there doesn't seem to be any way to store that these extra files 
have been generated.


-- Jack
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Specifying different warning levels for debug and release

2007-07-10 Thread Jack Kelly

Paul Richards wrote:

Hi,
Is there a way to specify different warning levels for debug and release?

Under Visual Studio 2003 we like to build debug with warning level 4,
and release at warning level 3.

Can CMake do this?


I don't know if Visual Studio uses CFLAGS for warning level (I assume it 
does), but this is how I'd do it for gcc:


IF(CMAKE_COMPILER_IS_GNUCC)
  SET(CMAKE_C_FLAGS_DEBUG -g -Wall -Werror)
  SET(CMAKE_C_FLAGS_RELEASE -O2 -pipe -fomit-frame-pointer -DNDEBUG)
  # And the other build types if necessary
ENDIF(CMAKE_COMPILER_IS_GNUCC)

Similarly, you can test for CMAKE_COMPILER_IS_GNUCXX and set 
CMAKE_CXX_FLAGS_*


The CFLAG variable used depends on CMAKE_BUILD_TYPE: None, Debug, 
Release, RelWithDebInfo, MinSizeRel, each of which corresponding to an 
appropriate CMAKE_LANG_FLAGS_TYPE entry in the cache.


Perhaps testing on IF(MSVC) will be helpful for you. See 
http://www.cmake.org/Wiki/CMake_Useful_Variables


-- Jack
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] non default architecture builds

2007-07-09 Thread Jack Kelly

Alexander Neundorf wrote:

Now my question:
How can I make cmake look into the lib/pa20_64 or lib/sparcv9 directory
instead of the plain lib directory?


After running cmake, can't you do a `make edit_cache` and manually set 
the appropriate cache entries (such as OPENGL_LIBRARIES, 
OPENGL_INCLUDE_DIR)? You might need to turn on advanced mode.


-- Jack
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] integrating cmake project with third party project

2007-06-25 Thread Jack Kelly

abhijeet mhatre wrote:

I am using cmake for my project. My project has a dependency which is a 3rd 
party makefile based project.
I want cmake to just go to the other project directory and execute make over 
there and come back.
I want this to be done when I type make.
Is there any way to do it?


Try ADD_CUSTOM_COMMAND.

-- Jack
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Adding Generated Header to VS Project

2007-06-19 Thread Jack Kelly

Brandon Van Every wrote:
 On 6/19/07, Mike Jackson [EMAIL PROTECTED] wrote:
 I have the following as part of my CMakeLists.txt file:

 
CONFIGURE_FILE(${MXADataModel_SOURCE_DIR}/src/Headers/MXAConfiguration.h.in

${PROJECT_BINARY_DIR}/MXAConfiguration.h @ONLY IMMEDIATE)
 INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR})

 And in a source file I then have:

 #include MXAConfiguration.h

 And when VS2003,Net tries to compile I get a warning that
 MXAConfiguration.h: No such file or directory. I have verified that
 the file gets generated and is in the proper location. I looked at the
 project properties in VS and my build directory is in fact NOT part of
 the include paths. What gives? This works fine on OS X/Linux? Is there
 something special I need to do for Windows?

Why do you say ${PROJECT_BINARY_DIR}? I thought you had to call it by 
the name you specify in PROJECT(), i.e., ${MXADataModel_BINARY_DIR}.


(@Brandon: Sorry for mailing off-list, you'll see this twice.)

-- Jack


___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Storing and auto-decrypting sensitive files in cmake SAFELY and SANELY

2007-06-17 Thread Jack Kelly

Gavin Beatty wrote:

Hello,

Apologies if this is silly/misplaced/misguided.

I'd like a way to automate decrypting (via gpg) a file, installing the
decrypted form and removing the temporary decrypted file from the
cmake dir.

I have tried:
code
MACRO(ETC_WPA_INSTALL src)
   EXEC_PROGRAM(gpg
   ARGS-o ${src} -d ${src}.encrypted
   )
   INSTALL(FILES   ${src}
   DESTINATION /etc/wpa_supplicant
   PERMISSIONS OWNER_READ OWNER_WRITE
   RENAME  wpa_supplicant.conf
   )
   FILE(REMOVE ${src})
ENDMACRO(ETC_WPA_INSTALL src)
/code

but the INSTALL doesn't actually run until `make install` (as
expected) whereas everything else does. So I get a decrypted file
which is immediately removed when I run `cmake .`! How silly of me

Is there a way to have the decryption as a dependency of install
target and have the removal at the end also?

How would you implement this?


Something to think about:
You want to decrypt and install the file without leaving it around in 
the build dir. Why? If you're doing an install, the person installing it 
should be root and therefore trustworthy (they'll have read access to 
/etc/wpa_supplicant.conf, anyway). Then there's the problem of the 
decryption key. If your build system can get this key, surely the user 
can, too.


Killing the make process at the right moment would leave the decrypted 
file lying around, as well.


Is what you think you want what you actually need?

Perhaps you should look at INSTALL(CODE Some CMake Code) which 
executes CMake code during installation. I'll stab in the dark here with:


FIND_PROGRAM(INSTALL_EXECUTABLE install)
IF(NOT INSTALL_EXECUTABLE)
  # Die, somehow
ENDIF(NOT INSTALL_EXECUTABLE)

FIND_PROGRAM(GPG_EXECUTABLE gpg)
IF(NOT GPG_EXECUTABLE)
  # Die
ENDIF(NOT GPG_EXECUTABLE)

MACRO(ETC_WPA_INSTALL FILE)
  EXEC_PROGRAM(${GPG_EXECUTABLE} ARGS -o ${FILE} -d ${FILE}.encrypted)
  EXEC_PROGRAM(${INSTALL_EXECUTABLE) -m 600 ${FILE} 
/etc/wpa_supplicant/wpa_supplicant.conf)

  FILE(REMOVE ${FILE})
ENDMACRO(ETC_WPA_INSTALL)

INSTALL(CODE ETC_WPA_INSTALL(file))

This isn't so great because it depends on an install program, but it 
might get you thinking.


-- Jack
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Re: How to integrate 3rd-party software into cmake system

2007-06-09 Thread Jack Kelly

Clark J. Wang wrote:

Clark J. Wang wrote:
  Another question:
 
  By default `make clean' does not know how to clean the 3rd-party
  package. How can I add another command which will be run by `make
clean'?
 


Have you tried:

ADD_CUSTOM_COMMAND(
  TARGET clean
  POST_BUILD
  COMMAND make
  ARGS clean
  WORKING_DIR dir
  VERBATIM
)

? I haven't, but it looks like it _should_ work.

-- Jack
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Three problems with cmake under windows

2007-06-05 Thread Jack Kelly

lucatrv wrote:
2) Since I have two fortran compilers installed, sometimes I chose to 
use gfortran and sometimes ifort.

However, If I use the following commands in this order:
PROJECT (hello Fortran)
SET (CMAKE_Fortran_COMPILER gfortran)
cmake still tests ifort working when creating the makefile.
The only whay to have cmake make use only of gfortran is to use the 
commands in the following order:

SET (CMAKE_Fortran_COMPILER gfortran)
PROJECT (hello Fortran)
I think it would be better that cmake set the right compiler also in 
the first case, also because the required order is not specified in 
the cmake documentation.


You can not set the compiler like that.   You have to set the 
environment variable FC before you run cmake.  There has been a 
request to add a way to do this from CMakeSetup, but it has not yet 
been implemented.


Would cmake -DCMAKE_Fortran_COMPILER:string=/path/to/gfortran work? I 
know it works for setting CMAKE_C_COMPILER for small MinGW test programs 
on Linux, but I'm not sure about the general case.


-- Jack
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Visual Studio GNU make projects

2007-06-01 Thread Jack Kelly

John Donovan wrote:
I'm new to CMake and the list, so forgive me if this has been asked 
before. We have a requirement to use GNU make to build our code, but we 
want to use Visual Studio 2005 as the IDE. Can CMake produce VS makefile 
projects but with a custom make command?


Hi, I'm also new to CMake, but couldn't you generate 2 out-of-tree build 
systems? One using MinGW/MSYS/Cygwin makefiles (depending on what you 
use) and one generating VS 2005 project files for development editing?


-- Jack
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake