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
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
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
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
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
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
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
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
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
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
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},
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
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.
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
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
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.
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
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
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
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
...@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
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
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
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
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
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
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
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
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
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
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
___
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
-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
/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
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
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
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
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:
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
.
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
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
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
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)
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
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
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
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
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
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
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
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
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.
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:
[
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.
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,
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,
19 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:
> >
> >
> > &g
>
> > 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:
> >
> >
> > >
> > >
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:
>
> 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
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
>
> > 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
>
> > 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
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)
>
> 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
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. #
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
ib_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 wa
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
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
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:
>
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
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
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
>
> >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
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
>
> >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
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
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,
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
|
80 matches
Mail list logo