[CMake] Spaces in a command

2014-07-25 Thread Bill Newcomb
I want to add stuff to a custom command based on some definition: cmake_minimum_required(VERSION 2.6) set(DO_RELAX 1) if(DO_RELAX) set(OR_RELAX || echo \no big deal\) else() set(OR_RELAX ) endif() add_custom_command(OUTPUT foo COMMAND generate-foo ${OR_RELAX}) add_custom_target(do-foo

Re: [CMake] Spaces in a command

2014-07-29 Thread Bill Newcomb
characters. http://www.cmake.org/cmake/help/v3.0/command/add_custom_command.html On Fri, Jul 25, 2014 at 11:20 AM, Bill Newcomb bnewc...@nvidia.com wrote: I want to add stuff to a custom command based on some definition: cmake_minimum_required(VERSION 2.6) set(DO_RELAX 1) if(DO_RELAX) set

Re: [CMake] Spaces in a command

2014-07-29 Thread Bill Newcomb
and subst space for semicolon? On Tue, Jul 29, 2014 at 11:13 AM, Bill Newcomb bnewc...@nvidia.com mailto:bnewc...@nvidia.com wrote: That doesn't work either: foo: $(CMAKE_COMMAND) -E cmake_progress_report /home/bnewcomb/tmp/cmake-tests/custom

Re: [CMake] custom target like add_executable

2015-02-04 Thread Bill Newcomb
Oops, so I guess it's not that it doesn't work at all, but that the add_custom_command gets run every time I 'make all', and that gnu make emits some warnings about circular dependencies. The first is more of a problem, but both are kind of annoying. Thanks, B. On 02/04/2015 01:36 PM, Bill

[CMake] custom target like add_executable

2015-02-04 Thread Bill Newcomb
When I specify add_executable(foo foo.c), I get both a top-level target (which defaults to ALL but can be set not to be) and an actual file that gets built that are named the same (Unix Makefiles). add_custom_target can get me the first of those for non-executable things, and

Re: [CMake] custom target like add_executable

2015-02-05 Thread Bill Newcomb
, Alan W. Irwin wrote: On 2015-02-05 10:14-0800 Bill Newcomb wrote: A contrived example: $ ls .. b CMakeLists.txt foo $ cat ../CMakeLists.txt cmake_minimum_required(VERSION 3.1) add_custom_target(foo.sha1 ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/foo.sha1) add_custom_command

Re: [CMake] custom target like add_executable

2015-02-05 Thread Bill Newcomb
paths with add_custom_command, but I don't know if that's still necessary. Using relative paths doesn't seem to change the outcome. Thanks, B. On 02/04/2015 06:59 PM, Alan W. Irwin wrote: On 2015-02-04 13:45-0800 Bill Newcomb wrote: Oops, so I guess it's not that it doesn't work at all

Re: [CMake] ARGV processing in cmake -P

2015-03-16 Thread Bill Newcomb
suite maintained and supported by Kitware (kitware.com/cmake). On Fri, Mar 13, 2015 at 7:50 PM, Bill Newcomb bnewc...@nvidia.com wrote: Any idea what I'm doing wrong here? $ cat foo.cmake foreach(n RANGE ${ARGC}) message(STATUS ${n} ${CMAKE_ARGV${n}}) endforeach() message(STATUS

[CMake] ARGV processing in cmake -P

2015-03-13 Thread Bill Newcomb
Any idea what I'm doing wrong here? $ cat foo.cmake foreach(n RANGE ${ARGC}) message(STATUS ${n} ${CMAKE_ARGV${n}}) endforeach() message(STATUS ${CMAKE_ARGV0}) message(STATUS ${CMAKE_ARGV1}) message(STATUS ${CMAKE_ARGV2}) $ cmake -P foo.cmake a b c -- 0 -- -- -- $ cmake a b c -P foo.cmake --

[CMake] Build cmake itself statically linked

2015-03-31 Thread Bill Newcomb
Is there a straightforward way to build statically linked cmake and ctest binaries on Linux? Thanks, B. --- This email message is for the sole use of the intended recipient(s) and may contain confidential

[CMake] rpath to libstdc++.so

2015-03-04 Thread Bill Newcomb
In cmake 2.6, I could do something kind of bogus like this: get_filename_component(MY_COMPILER_PREFIX ${CMAKE_C_COMPILER} PATH) set(MY_RPATH ${MY_COMPILER_PREFIX}/../CentOS-5.7/x86_64/lib) link_directories(${MY_RPATH}) set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)

[CMake] linking question

2015-04-15 Thread Bill Newcomb
The following is all on Linux (with gcc, gnu binutils, etc). I'm trying to build libfred.so that uses code from libjoe.a, but I want libfred.so to be complete, i.e. I don't want any program that I build that links to libfred.so also need libjoe.a. Then I want to build executable mike that is

Re: [CMake] linking question

2015-04-16 Thread Bill Newcomb
in fred target_link_libraries(mike fred) I hope this helps. Petr On Thu, Apr 16, 2015 at 12:07 AM, Bill Newcomb bnewc...@nvidia.com mailto:bnewc...@nvidia.com wrote: The following is all on Linux (with gcc, gnu binutils, etc). I'm trying to build libfred.so that uses code from libjoe.a

[CMake] Determining a library name at configure time

2015-09-18 Thread Bill Newcomb
Suppose I add a library in my project: add_library(foo STATIC foo.c bar.c) Is there a way I can get the name of the generated library file at configure time? LIBRARY_OUTPUT_NAME and OUTPUT_NAME for the target do not seem to be set: get_target_property(libname foo LIBRARY_OUTPUT_NAME)

Re: [CMake] Determining a library name at configure time

2015-09-22 Thread Bill Newcomb
Anyone? Thanks, B. On 09/18/2015 11:42 AM, Bill Newcomb wrote: Suppose I add a library in my project: add_library(foo STATIC foo.c bar.c) Is there a way I can get the name of the generated library file at configure time? LIBRARY_OUTPUT_NAME and OUTPUT_NAME for the target do not seem

Re: [CMake] Determining a library name at configure time

2015-09-22 Thread Bill Newcomb
further description--I know it's a mess :-) Thanks, B. On 09/22/2015 11:50 AM, Nils Gladitz wrote: On 09/18/2015 11:42 AM, Bill Newcomb wrote: Suppose I add a library in my project: add_library(foo STATIC foo.c bar.c) Is there a way I can get the name of the generated library file at configure

[CMake] set_if_not_set

2017-02-15 Thread Bill Newcomb
My top-level CMakeLists.txt files always end up with a lot of if(NOT_DEFINED foo) set(foo bar) endif() things to allow people to pass interesting things on the command line or to write their own "set this and that" CMakeLists.txt and include the top-level one. It would improve