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 r
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, 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
tar_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/
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, ple
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 o
>
> >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 projec
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-compi
>
> >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-too
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
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 hierarchic
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
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
| |
>
> 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 ti
>
> > 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 recor
>
> > 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
>
> 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 "Bu
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-sourc
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-
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)
ad
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:
> >
> >
> > >
> > >
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. #
##
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
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
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 mor
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
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 lin
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 Hwan
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
> S
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 othe
10:55
> To: David Aldrich
> Cc: cmake@cmake.org
> Subject: [CMake] Error finding boost libraries
>
>
> > From: David Aldrich
> > Subject:
> > To: "cmake@cmake.org"
> >
> > The following command is not working for me:
> >
> > find_p
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
> C
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 D
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 con
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 runti
. 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
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,--
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 no
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 yo
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 arch
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 manua
ake.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
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.or
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 in
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
___
Powere
Hi Michael
> Ok, to clear things up:
> 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
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 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 s
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
Hi
I want to generate a source file 'SourceFileInfo.cpp', then build a library and
then delete the generated file.
So I wrote:
add_custom_command (
OUTPUT SourceFileInfo.cpp
COMMAND ../VersionInfo/_gnuRelease/versionInfo . KERNEL
DEPENDS ${SRCS}
COMMENT "Generating SourceFileInfo.cpp"
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 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 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 Kerne
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, 201
...@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
mailto:david.aldr...@eu.nec.com>> wrote:
Hi
I have now successfully configured CMakeLists files to create some
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 <
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
Hi
I have tried to set the output directory for my library as follows:
# set destination directory for LIBRARY target (i.e. libKernel.a)
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ./_gnuRelease )
# build the Kernel static library
add_library(Kernel STATIC ${SRCS})
however, the library is being create
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:
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 sta
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 anoth
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:
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_BINAR
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. Th
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.kitwar
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_BIN
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
> 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
___
nal 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
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 Arjen
Thanks for your answer.
Best regards
David
> -Original Message-
> From: Arjen Markus [mailto:arjen.mar...@deltares.nl]
> Sent: 07 September 2010 15:07
> To: David Aldrich
> Cc: CMake@cmake.org
> Subject: Re: [CMake] Complete beginner question about tuto
plete 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 comman
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
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 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 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
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\buildnmake>path=...\plplot-5.9.5\buildnmake\dll;%PATH%
C:\plplot-5.9.5\buildnmake>nmake
and the nmake output t
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_INSTAL
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_INSTAL
82 matches
Mail list logo