[CMake] Fwd: Visual Studio command line from CMake
Thanks for the tip, but that hasn't been very helpful to me. Perhaps I'm not doing it right. Here is a bit of CMake code so the conversation can be more concrete. Perhaps someone on list can try it out... You'll need these two files... http://www.fltk.org/software.php?VERSION=1.3.2&FILE=fltk/1.3.2/fltk-1.3.2-source.tar.gz http://seriss.com/people/erco/fltk/tmp/vsnet-makefiles.0.85.zip Place them in the same directory with the following in the CMakeLists.txt CMAKE_MINIMUM_REQUIRED( VERSION 2.8 ) INCLUDE( ExternalProject ) SET( VS_MAKEFILE_ZIP vsnet-makefiles.0.85.zip ) ExternalProject_Add( FLTK URL ${CMAKE_SOURCE_DIR}/fltk-1.3.2-source.tar UPDATE_COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/${VS_MAKEFILE_ZIP} /${VS_MAKEFILE_ZIP} COMMAND ${CMAKE_COMMAND} -E tar -xzf /${VS_MAKEFILE_ZIP} PATCH_COMMAND "" CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" ) To build this manually, first, unzip both files into the same directory. Then, launch the Visual Studio Command Prompt, usually accessed via the VS/vcvarsall.bat program included with Visual Studio. Once both files are unzipped into the same directory, and you are in the VS prompt environment, you can build FLTK using the batch program 'gmake.bat'. For better or worse, it prompts the user to input for Debug or Release, and then for Verbose or Quiet. If you make a simple text file with the entries one per line... *** input.txt R Q *** You can feed that to the batch program thusly gmake < input.txt Alternately, if you can set DEBUG=R and VERBOSE=Q environment variables to the shell used to run 'gmake.bat', then you don't have to feed the text file for the user-input prompts. I tried something like the following BUILD_COMMAND ${CMAKE_COMMAND} --build -- gmake But, it didn't seem to do anything useful Rob On Wed, Jan 8, 2014 at 5:31 PM, J Decker wrote: > cmake --build > > On Wed, Jan 8, 2014 at 3:53 PM, Rob McDonald > wrote: > > Short version: > > > > Does anyone have an elegant way to launch the visual studio command line > > from within CMake? > > > > James Bigler asked essentially this question back in March of 2011. > David > > responded with a link to a Blog entry, but I haven't figured out how to > > translate that into something that works. > > > > The 'vcvarsall.bat' program that comes with Visual Studio will launch the > > command line with the full environment set. > > > > Once I find vcvarsall, I then need to launch something in it -- and pass > > parameters to that thing. All from within ExternalProject_Add. For now, > > one step at a time... > > > > Long version: > > > > I'm trying to encapsulate the build of FLTK as an ExternalProject in > CMake. > > One way or the other, it needs to work for Visual Studio on Windows, and > gcc > > and llvm on Linux/MacOS. > > > > Although FLTK has a CMake build system, it is currently unmaintained > (broken > > on at least some platforms), and none of the core FLTK developers use > it, so > > I don't see this situation improving. > > > > I've got a ./configure based system working for Linux/MacOS. > > > > One of the FLTK developers maintains an unofficial Makefile setup for > > FLKT/Visual Studio that must be run from the Visual Studio command > prompt. > > Hence my question... > > > > http://seriss.com/people/erco/fltk/tmp/vsnet-makefiles.0.85.zip > > > > Thanks for any help, > > > > Rob > > > > > > > > > > -- > > > > 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://www.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: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Visual Studio command line from CMake
Very sorry for not replying to the list, I certainly meant to. I didn't mean to impose my problem on you -- and I was hoping that by flushing my example out more fully, more people may be able to help out. I will go back and forward that response/question so people don't have to dig it out of this chain. On Wed, Jan 8, 2014 at 8:49 PM, J Decker wrote: > (you should have replied that back to the list) > My uppermost project is a project chain of independant source parts in > my tree... the topmost project writes out makeit.bat configuration > files with a "cmake ..." command that has all the required options and > switches (I'll append at end) and then the appropriate build command > for the cmake environment... > > but then from the commandline I just do cmake --build . in the > directory... (or makeit.bat) > > maybe you need something like... (I took the build command (and cmake > command for the configuration of it) > > if( MSVC ) > > if( NOT EXISTS ${BUILD}/${SOLUTION}.sln ) > > FILE( WRITE ${BUILD}/${SOLUTION}.sln ) > > endif() > > if( ${CMAKE_MAKE_PROGRAM} MATCHES .*[Mm][Ss][Bb]uild.* ) > > build_command( BUILD_COMMAND CONFIGURATION ${CMAKE_BUILD_TYPE} > PROJECT_NAME ${SOLUTION} TARGET INSTALL ) > > SET( MORE_ARGS /m:4 /v:m ) > > else() > >build_command( BUILD_COMMAND CONFIGURATION ${CMAKE_BUILD_TYPE} > PROJECT_NAME ${SOLUTION} TARGET INSTALL.vcxproj ) > > endif() > > SEPARATE_ARGUMENTS( BUILD_COMMAND WINDOWS_COMMAND ${BUILD_COMMAND} ) > > SET( BUILD_COMMAND ${BUILD_COMMAND} ${MORE_ARGS} ) > > SET( ADD_SOURCES SOURCES ${BUILD}/${SOLUTION}.sln ) > > else( MSVC ) > > build_command( BUILD_COMMAND CONFIGURATION ${CMAKE_BUILD_TYPE} > PROJECT_NAME ${SOLUTION} TARGET install ) > > SEPARATE_ARGUMENTS( BUILD_COMMAND UNIX_COMMAND ${BUILD_COMMAND} ) > > endif( MSVC ) > > > > > Then later I had to - > > string (REPLACE ";" " " FAKE_BUILD_COMMAND "${BUILD_COMMAND}") > FILE( APPEND ${BUILD}/${SCRIPTNAME} ${FAKE_BUILD_COMMAND} ) > > I was writing the invokation to a file... I don't know if the > expansion from ';' to space is required if it's used with > execute_process > > EXECUTE_PROCESS(COMMAND ${BUILD_COMMAND} ) > > > --- sample makeit.bat --- > "c:/tools/unix/cmake/bin/cmake.exe" -G "Visual Studio 11" -T "v110_xp" > "M:/sack/cmake_all/.." -DCMAKE_BUILD_TYPE=debug > > -DCMAKE_INSTALL_PREFIX=C:/general/build/vs11-x86.monolithic/sack/debug_solution/../debug_out/core > -DBUILD_MONOLITHIC=1 -D__NO_ODBC__= -DNEED_FREETYPE=1 -DNEED_JPEG=1 > -DNEED_PNG=1 -DNEED_ZLIB=1 -DBULLET_SOURCE=M:/bullet/source > > C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe > INSTALL.vcxproj /p:Configuration=debug /p:VisualStudioVersion=11.0 > /m:4 /v:m > --- end sample makeit.bat --- > > > And Please understand I may be totally missing your point... > > When is it that you want to run msbuild? > As far as I know, I never run msbuild. The command line Makefile driven system Erco put together (the non-FLTK download link from before) is a one-stop shop. By running 'gmake.bat', it configures the program and then launches the build via gmake.exe. I do not believe it ever creates a *.prj or *.sln file. I do not believe it ever runs msbuild. I believe gmake works with the Makefile to call the compiler via 'cl' directly. However, I haven't dug super deep into Erco's magic. Rob > On Wed, Jan 8, 2014 at 7:50 PM, Rob McDonald > wrote: > > Thanks for the tip, but that hasn't been very helpful to me. Perhaps I'm > > not doing it right. Here is a bit of CMake code so the conversation can > be > > more concrete... > > > > You'll need these two files... > > > > > http://www.fltk.org/software.php?VERSION=1.3.2&FILE=fltk/1.3.2/fltk-1.3.2-source.tar.gz > > http://seriss.com/people/erco/fltk/tmp/vsnet-makefiles.0.85.zip > > > > Place them in the same directory with the following in the CMakeLists.txt > > > > CMAKE_MINIMUM_REQUIRED( VERSION 2.8 ) > > > > INCLUDE( ExternalProject ) > > > > SET( VS_MAKEFILE_ZIP vsnet-makefiles.0.85.zip ) > > > > ExternalProject_Add( FLTK > > URL ${CMAKE_SOURCE_DIR}/fltk-1.3.2-source.tar > > UPDATE_COMMAND > > ${CMAKE_COMMAND} -E copy_if_different > > ${CMAKE_SOURCE_DIR}/${VS_MAKEFILE_ZIP} > > /${VS_MAKEFILE_ZIP} > > COMMAND > > ${CMAKE_COMMAND} -E tar -xzf /${VS_MAKEFILE_ZIP} > > > > PATCH_COMMAND "" > > CONFIGURE_COMMAND "" > > BUILD_COMMAND "" > > INSTALL_COMMAND "" > > ) > > > > > > To build this manually, first, unzip both files into the same directory. > > Then, launch the Visual Studio Command Prompt, usually accessed via the > > VS/vcvarsall.bat program included with Visual Studio. > > > > Once both files are unzipped into the same directory, and you are in the > VS > > prompt environment, you can build FLTK using the batch program > 'gmake.bat'. > > > > For better or worse, it prompts the user to input for Debug or Release, > and > > then for Verbose or Quiet. If you make a simple text file with
Re: [CMake] Visual Studio command line from CMake
cmake --build On Wed, Jan 8, 2014 at 3:53 PM, Rob McDonald wrote: > Short version: > > Does anyone have an elegant way to launch the visual studio command line > from within CMake? > > James Bigler asked essentially this question back in March of 2011. David > responded with a link to a Blog entry, but I haven't figured out how to > translate that into something that works. > > The 'vcvarsall.bat' program that comes with Visual Studio will launch the > command line with the full environment set. > > Once I find vcvarsall, I then need to launch something in it -- and pass > parameters to that thing. All from within ExternalProject_Add. For now, > one step at a time... > > Long version: > > I'm trying to encapsulate the build of FLTK as an ExternalProject in CMake. > One way or the other, it needs to work for Visual Studio on Windows, and gcc > and llvm on Linux/MacOS. > > Although FLTK has a CMake build system, it is currently unmaintained (broken > on at least some platforms), and none of the core FLTK developers use it, so > I don't see this situation improving. > > I've got a ./configure based system working for Linux/MacOS. > > One of the FLTK developers maintains an unofficial Makefile setup for > FLKT/Visual Studio that must be run from the Visual Studio command prompt. > Hence my question... > > http://seriss.com/people/erco/fltk/tmp/vsnet-makefiles.0.85.zip > > Thanks for any help, > > Rob > > > > > -- > > 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://www.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: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Provide 64bit Linux binaries
Hi, On Wed, Jan 8, 2014 at 10:07 PM, Magnus Therning wrote: > On Wed, Jan 08, 2014 at 01:56:22PM +0100, Andreas Pakulat wrote: > > Hi, > > > > I know this has been raised in the past, but I don't think the > > arguments for not providing the binaries are strong enough to > > warrant the hassle a cmake user has to go through to run the 32bit > > binaries on a 64bit Linux distribution. > > > > I think requiring users to figure out how to install 32bit compat > > libraries and keeping a copy of at least libc on the machine for no > > other purpose than running cmake does not really fit the intention > > of providing binaries in the first place. As far as I understand the > > idea was to make it easier for people who cannot upgrade a > > package-manager-provided CMake (for whatever reason) to use a newer > > CMake. Requiring those people to build from source does not really > > make it easy and not all distributions install 32bit compat > > libraries out of the box (let alone older machines which have no > > such compat libs at all) > > > > So can we please get 64bit Linux binaries for the next CMake > > release? > > What 64-bit Linux distribution, that doesn't package CMake, do you > use? > I did not say there is no CMake package, the point I'm trying to make is that if someone wants or needs a newer CMake release than his Distro provides this is not as easy as it should be for a 64Bit Linux system (that does not yet have 32bit compat libs installed). Andreas -- 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://www.cmake.org/mailman/listinfo/cmake
[CMake] Visual Studio command line from CMake
Short version: Does anyone have an elegant way to launch the visual studio command line from within CMake? James Bigler asked essentially this question back in March of 2011. David responded with a link to a Blog entry, but I haven't figured out how to translate that into something that works. The 'vcvarsall.bat' program that comes with Visual Studio will launch the command line with the full environment set. Once I find vcvarsall, I then need to launch something in it -- and pass parameters to that thing. All from within ExternalProject_Add. For now, one step at a time... Long version: I'm trying to encapsulate the build of FLTK as an ExternalProject in CMake. One way or the other, it needs to work for Visual Studio on Windows, and gcc and llvm on Linux/MacOS. Although FLTK has a CMake build system, it is currently unmaintained (broken on at least some platforms), and none of the core FLTK developers use it, so I don't see this situation improving. I've got a ./configure based system working for Linux/MacOS. One of the FLTK developers maintains an unofficial Makefile setup for FLKT/Visual Studio that must be run from the Visual Studio command prompt. Hence my question... http://seriss.com/people/erco/fltk/tmp/vsnet-makefiles.0.85.zip Thanks for any help, Rob -- 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://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Provide 64bit Linux binaries
On 1/8/2014 4:07 PM, Magnus Therning wrote: What 64-bit Linux distribution, that doesn't package CMake, do you use? Still it is not a bad idea to provide them since 32 bit is now mostly a compatibility thing. It maybe that a distro does not provide the most recent version or a user does not have root or sudo access on the machine. I will look into creating 64 bit binaries. Thanks. -Bill -- 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://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Provide 64bit Linux binaries
On Wed, Jan 08, 2014 at 01:56:22PM +0100, Andreas Pakulat wrote: > Hi, > > I know this has been raised in the past, but I don't think the > arguments for not providing the binaries are strong enough to > warrant the hassle a cmake user has to go through to run the 32bit > binaries on a 64bit Linux distribution. > > I think requiring users to figure out how to install 32bit compat > libraries and keeping a copy of at least libc on the machine for no > other purpose than running cmake does not really fit the intention > of providing binaries in the first place. As far as I understand the > idea was to make it easier for people who cannot upgrade a > package-manager-provided CMake (for whatever reason) to use a newer > CMake. Requiring those people to build from source does not really > make it easy and not all distributions install 32bit compat > libraries out of the box (let alone older machines which have no > such compat libs at all) > > So can we please get 64bit Linux binaries for the next CMake > release? What 64-bit Linux distribution, that doesn't package CMake, do you use? /M -- Magnus Therning OpenPGP: 0xAB4DFBA4 email: mag...@therning.org jabber: mag...@therning.org twitter: magthe http://therning.org/magnus Unreadable code, Why would anyone use it? Learn a better way. -- Geoff Kuenning's contribution to the 2004 Perl Haiku Contest, Haikus about Perl - 'Dishonerable Mention' winner pgp67m1IxiNo6.pgp Description: PGP signature -- 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://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Backslash instead of slashes in *.vcxproj files
On 1/7/2014 11:12 AM, NoRulez wrote: > is there a simple way to replace the slashes (directory delimiter) > with backslashes for include paths after or during the generation > of *.vcxproj files? This is a bug in the VS 10 generator of CMake. Paths are correctly converted to use backslashes in VS <= 9 generators. I just fixed the VS >= 10 generators: VS: Convert include path to backslashes for VS >= 10 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c1311077 Try out the next nightly build that appears (2.8.12.20140108 or later): http://www.cmake.org/files/dev/?C=M;O=D It should include this fix. -Brad -- 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://www.cmake.org/mailman/listinfo/cmake
[CMake] Use ctest with callgrind
Hi I am trying to use valgrind with callgrind tool for performance profiling. In my CMakeLists.txt file I have the following lines: include(CTest) set(CTEST_MEMORYCHECK_COMMAND_OPTIONS "--tool=callgrind --dump-instr=yes --simulate-cache=yes --collect-jumps=yes") add_subdirectory(profile) however, it seems that valgrind is not called with callgrind tool when using ctest -D ExperimentalMemCheck and no callgrind.out.* file is generated. Is there a way to rewrite the default options for valgrind command ? thanks Bogdan -- 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://www.cmake.org/mailman/listinfo/cmake
[CMake] Use ctest with callgrind
Hi I am trying to use valgrind with callgrind tool for performance profiling. In my CMakeLists.txt file I have the following lines: include(CTest) set(CTEST_MEMORYCHECK_COMMAND_OPTIONS "--tool=callgrind --dump-instr=yes --simulate-cache=yes --collect-jumps=yes") add_subdirectory(profile) however, it seems that valgrind is not called with callgrind tool when using ctest -D ExperimentalMemCheck and no callgrind.out.* file is generated. Is there a way to rewrite the default options for valgrind command ? thanks Bogdan -- 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://www.cmake.org/mailman/listinfo/cmake
[CMake] Provide 64bit Linux binaries
Hi, I know this has been raised in the past, but I don't think the arguments for not providing the binaries are strong enough to warrant the hassle a cmake user has to go through to run the 32bit binaries on a 64bit Linux distribution. I think requiring users to figure out how to install 32bit compat libraries and keeping a copy of at least libc on the machine for no other purpose than running cmake does not really fit the intention of providing binaries in the first place. As far as I understand the idea was to make it easier for people who cannot upgrade a package-manager-provided CMake (for whatever reason) to use a newer CMake. Requiring those people to build from source does not really make it easy and not all distributions install 32bit compat libraries out of the box (let alone older machines which have no such compat libs at all) So can we please get 64bit Linux binaries for the next CMake release? Andreas -- 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://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Generating multiple targets in parallel generates common prerequisites twice
Hi Eike, thanks for the pointer. I verified, that it works with the current git version of cmake. So the problem will be fixed with the next CMake release. Martin On 08/01/14 10:00, Rolf Eike Beer wrote: Am 08.01.2014 09:42, schrieb Martin Apel: Hi all, I hope this question hasn't been asked before, I haven't found anything useful in the archive. Assume I have the following small CMakeLists.txt file: CMAKE_MINIMUM_REQUIRED (VERSION 2.8) PROJECT(testCMakeDeps) ADD_LIBRARY(foo SHARED foo.cpp) ADD_LIBRARY(bar SHARED bar.cpp) ADD_EXECUTABLE(test test.cpp) TARGET_LINK_LIBRARIES(test foo bar) ADD_EXECUTABLE(test2 test2.cpp) TARGET_LINK_LIBRARIES(test2 foo bar) This creates two executables, which both depend on the same two shared libraries. When generating a Makefile for this on Linux, one can start the compilation process via 'make -j2 test test2', i.e. name two separate targets on the command line. However CMake seems to generate a Makefile, which does not work correctly in this case. The shared libraries are generated twice. This seems to be a CMake issue, not a Make issue, I can write a Makefile by hand, which works correctly in this case. Is there any way around the duplicate generation (which sometimes fails, because the same libraries may be generated simultaneously)? Could you please try a CMake version from the next branch, I think that this has been fixed recently. Eike -- 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://www.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: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Add -lrt at the end of link.txt
Thank you very much for your help. Actually, there are two CMakeLists.txt files in the project I work on. Targets are only defined in one of them. This is the reason why I did not find them. It works fine now! Best regards, Cédric Doucet - Mail original - > De: "Rolf Eike Beer" > À: cmake@cmake.org > Envoyé: Mercredi 8 Janvier 2014 09:59:06 > Objet: Re: [CMake] Add -lrt at the end of link.txt > > Am 08.01.2014 08:42, schrieb Jakub Zakrzewski: > > Hello, > > I recommend reading some kind of CMake tutorial to get at least the > > basic concepts. In the mean time: > > > > --- CMakeLists.txt --- > > cmake_minimum_required(VERSION 2.8.6) > > project(oci_object_test) > > > > set(ORCLIB_HOME /home/jzakrzewski/local/ocilib/usr/local) > > > > include_directories(${ORCLIB_HOME}/include) > > link_directories(${ORCLIB_HOME}/lib64) > > > > link_directories(/usr/lib/oracle/11.2/client64/lib) > > This is wrong. Don't use link_directories. > > > set(SOURCES > > main.cpp > > ) > > > > add_executable(demo ${SOURCES}) > > target_link_libraries(demo clntsh ocilib) > > --- CMakeLists.txt --- > > Use target_link_libraries() with absolute pathnames to the libraries > you > need. find_library() can help you gathering those. > > Eike > -- > > 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://www.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: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Generating multiple targets in parallel generates common prerequisites twice
Am 08.01.2014 09:42, schrieb Martin Apel: Hi all, I hope this question hasn't been asked before, I haven't found anything useful in the archive. Assume I have the following small CMakeLists.txt file: CMAKE_MINIMUM_REQUIRED (VERSION 2.8) PROJECT(testCMakeDeps) ADD_LIBRARY(foo SHARED foo.cpp) ADD_LIBRARY(bar SHARED bar.cpp) ADD_EXECUTABLE(test test.cpp) TARGET_LINK_LIBRARIES(test foo bar) ADD_EXECUTABLE(test2 test2.cpp) TARGET_LINK_LIBRARIES(test2 foo bar) This creates two executables, which both depend on the same two shared libraries. When generating a Makefile for this on Linux, one can start the compilation process via 'make -j2 test test2', i.e. name two separate targets on the command line. However CMake seems to generate a Makefile, which does not work correctly in this case. The shared libraries are generated twice. This seems to be a CMake issue, not a Make issue, I can write a Makefile by hand, which works correctly in this case. Is there any way around the duplicate generation (which sometimes fails, because the same libraries may be generated simultaneously)? Could you please try a CMake version from the next branch, I think that this has been fixed recently. Eike -- 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://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Add -lrt at the end of link.txt
Am 08.01.2014 08:42, schrieb Jakub Zakrzewski: Hello, I recommend reading some kind of CMake tutorial to get at least the basic concepts. In the mean time: --- CMakeLists.txt --- cmake_minimum_required(VERSION 2.8.6) project(oci_object_test) set(ORCLIB_HOME /home/jzakrzewski/local/ocilib/usr/local) include_directories(${ORCLIB_HOME}/include) link_directories(${ORCLIB_HOME}/lib64) link_directories(/usr/lib/oracle/11.2/client64/lib) This is wrong. Don't use link_directories. set(SOURCES main.cpp ) add_executable(demo ${SOURCES}) target_link_libraries(demo clntsh ocilib) --- CMakeLists.txt --- Use target_link_libraries() with absolute pathnames to the libraries you need. find_library() can help you gathering those. Eike -- 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://www.cmake.org/mailman/listinfo/cmake
[CMake] Generating multiple targets in parallel generates common prerequisites twice
Hi all, I hope this question hasn't been asked before, I haven't found anything useful in the archive. Assume I have the following small CMakeLists.txt file: CMAKE_MINIMUM_REQUIRED (VERSION 2.8) PROJECT(testCMakeDeps) ADD_LIBRARY(foo SHARED foo.cpp) ADD_LIBRARY(bar SHARED bar.cpp) ADD_EXECUTABLE(test test.cpp) TARGET_LINK_LIBRARIES(test foo bar) ADD_EXECUTABLE(test2 test2.cpp) TARGET_LINK_LIBRARIES(test2 foo bar) This creates two executables, which both depend on the same two shared libraries. When generating a Makefile for this on Linux, one can start the compilation process via 'make -j2 test test2', i.e. name two separate targets on the command line. However CMake seems to generate a Makefile, which does not work correctly in this case. The shared libraries are generated twice. This seems to be a CMake issue, not a Make issue, I can write a Makefile by hand, which works correctly in this case. Is there any way around the duplicate generation (which sometimes fails, because the same libraries may be generated simultaneously)? Martin -- 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://www.cmake.org/mailman/listinfo/cmake