Re: [CMake] project directive overwrites CMAKE_INSTALL_PREFIX?

2014-12-05 Thread Chris Johnson
This looks like a bug to me. I have a very simple test case where CMAKE_INSTALL_PREFIX is set correctly if I do so after the project() statement, and fails to be set correctly if I do it before the project() statement. On Fri, Dec 5, 2014 at 2:06 PM, Chris Johnson wrote: > Strangely, running "c

Re: [CMake] Get native build command with CMake 3+

2014-12-05 Thread J Decker
Isn't it as smiple as add_subdirectory( examples_dir ) which has it's own CMakeLists? Does it really have to build as an extra step or would OPTION( BUILD_EXAMPLES "Build Examples?" ON ) if( BUILD_EXAMPLES) add_subdirectory( examples_dir) endif( BUILD_EXAMPLES) On Fri, Dec 5, 2014 at 7:41 A

Re: [CMake] Common language runtime

2014-12-05 Thread J Decker
To enable compiling as/with CLR... SET_TARGET_PROPERTIES(bag PROPERTIES COMPILE_FLAGS "/CLR" ) # need to set unicode characters... add_definitions( -D_UNICODE -DUNICODE ) string( REPLACE "/EHsc" "" CMAKE_CXX_FLAGS_INIT ${CMAKE_CXX_FLAGS_INIT} ) string( REPLACE "/EHsc" "

[CMake] Common language runtime

2014-12-05 Thread Apoorva Gaddagimath
Hi everyone, I'm trying to add a .NET assembly reference to my CMake project. Various forums on Google suggested to use /clr. The problem I've found, is that while CMake sets the "Common Language RunTime Support" option in the C/C++ section of the configuration properties if "/clr" is in the CXX

Re: [CMake] project directive overwrites CMAKE_INSTALL_PREFIX?

2014-12-05 Thread Chris Johnson
Strangely, running "cmake -DCMAKE_INSTALL_PREFIX=/some/path" does NOT rewrite the cmake_install.cmake, but does rewrite the CMakeCache.txt and other files. The result is a bad install path won't go away until one manually removes the cmake_install.cmake file(s). On Thu, Dec 4, 2014 at 9:48 PM, J

[CMake] unexpected behavior with TARGET_FILE_DIR and Visual Studio 2010

2014-12-05 Thread Michael Ellery
Hi cmake-users, I have the following setup: CMAKE: 3.0.2 Visual Studio 2010 In one of my cmake files, I’m trying to create a preprocessor definition based on the TARGET_FILE_DIR of a different target … so I’m trying this: target_compile_definitions(my_target_B PUBLIC -DTARGET_A_DIR="$" )

Re: [CMake] Get native build command with CMake 3+

2014-12-05 Thread Petr Kmoch
OK, sorry for misunderstanding. But then I don't have a target like this. Basically, I am trying to create a custom target that would do this: # When using Makefile generator add_custom_target( examples COMMAND make -C example_dir all VERBATIM ) # When using vs2008 generator add_custom_targ

Re: [CMake] Get native build command with CMake 3+

2014-12-05 Thread David Cole via CMake
No, I meant exactly what I said. --target takes a CMake target name. HTH, D On Fri, Dec 5, 2014 at 9:23 AM, Petr Kmoch wrote: > I assume you actually meant 'cmake --build . --target example_dir', the name > of the directory. 'examples' is the name of the custom target; if that > target's com

Re: [CMake] Get native build command with CMake 3+

2014-12-05 Thread Petr Kmoch
Hi Micha. I understand how the original works, and I know I can work around it with a separate buildsystem (using e.g. ExternalProject_Add() or ctest --build-and-test). I was just wondering: since CMake generates a .sln (or Makefile) in the subdirectory (because I put a project() call in there), d

Re: [CMake] Get native build command with CMake 3+

2014-12-05 Thread Hendrik Sattler
Hi, this original makefile rule was probably just a simplification. Make your custom target depend on all example targets which link the desired parts, then you get what the original makefile author just didn't want to do manually: having built all examples and their dependencies. And it's less

Re: [CMake] Get native build command with CMake 3+

2014-12-05 Thread Micha Hergarden
Hello Petr, In your example the original make command simply states that it should switch to the example_dir and build an 'all' target there. It does not specify how this target is build. That is the part that should end up in your custom command. You can name the command 'examples', set WORKING_D

Re: [CMake] Get native build command with CMake 3+

2014-12-05 Thread Petr Kmoch
I assume you actually meant 'cmake --build . --target example_dir', the name of the directory. 'examples' is the name of the custom target; if that target's command was to build itself, I believe it would become a fork bomb. Anyway, I tried it with the directory name, it doesn't work. I'm generati

Re: [CMake] Visual Studio 12 C++ Compiler Detection

2014-12-05 Thread Allen Barnett
Hi Jakub: Thanks for the tip. What is the proper way to execute the compiler during the initial configure step? try_compile? Thanks, Allen > So, it appears to find the compiler OK since it emits the correct compiler > identification. But, the actual value of CMAKE_CXX_COMPILER is not usable. If

Re: [CMake] Get native build command with CMake 3+

2014-12-05 Thread David Cole via CMake
Try: cmake --build . --target examples (where "." represents the current working directory, and assumes you're in the top level build tree...) On Fri, Dec 5, 2014 at 5:46 AM, Petr Kmoch wrote: > Hi all. > > I'm converting a small Makefile-based project to CMake. The project is not > mine, so I

[CMake] Get native build command with CMake 3+

2014-12-05 Thread Petr Kmoch
Hi all. I'm converting a small Makefile-based project to CMake. The project is not mine, so I am trying to match its existing buildsystem as closely as possible. One of the rules in the original Makefile is (simplified) as follows: examples: all make -C example_dir all This gives a target 'ex

Re: [CMake] Visual Studio 12 C++ Compiler Detection

2014-12-05 Thread Jakub Zakrzewski
> So, it appears to find the compiler OK since it emits the correct compiler > identification. But, the actual value of CMAKE_CXX_COMPILER is not usable. If > you try to execute > C:/Program…./x86_amd64/cl.exe from within a CMake script or even from the > command line, it will fail and produce

Re: [CMake] Correct settings to add docopt.cpp to target list

2014-12-05 Thread Adam Getchell
It turns out that CGAL's CGAL_CreateSingleSourceCGALProgram.cmake module handles this nicely: create_single_source_cgal_program( "src/cdt-docopt.cpp" "src/docopt/docopt.cpp") does the trick. Thanks for your consideration! On Thu, Dec 4, 2014 at 10:54 PM, Adam Getchell wrote: > I should note t

[CMake] Generate Eclipse project with support for c++ 11

2014-12-05 Thread Luca Gherardi
Hi all, I’m writing a CMake file for a project that should be compiled both in Ubuntu and OS X. I want to use eclipse as IDE, gcc and C++ 11. I read different threads that suggest how to enable C++ 11 in eclipse. According to them I included these lines in my CMake: set(CMAKE_CXX_FLAGS "${CMAKE