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

2014-12-04 Thread Adam Getchell
I should note that I'm doing an out of source build, and that for my
project the following line works:

┌─[*adam*][Hapkido][*±*][docopt *✓*][~/CDT-plusplus/build]

└─▪ clang++ --std=c++11 --stdlib=libc++ -I ../src/docopt
../src/docopt/docopt.cpp ../src/cdt-docopt.cpp -o cdt_docopt

On Thu, Dec 4, 2014 at 9:30 PM, Adam Getchell 
wrote:

> Hello all,
>
> I’m trying to use the docopt.cpp parser for my project[1]:
>
> https://github.com/docopt/docopt.cpp
>
> The usual invocation to build works:
>
> ┌─[*adam*][Hapkido][*±*][docopt *✗*][~/CDT-plusplus/src/docopt]
> └─▪ clang++ --std=c++11 --stdlib=libc++ -I . docopt.cpp
> examples/naval_fate.cpp -o naval_fate
>
> So, I want to add docopt.cpp and have the compiler look for header files
> in the same directory, and add that to my executable.
>
> So far, what I’ve attempted is to add the lines:
>
> include_directories (BEFORE "src/docopt")
> add_library(docopt.cpp "src/docopt/docopt.cpp”)
>
> My program uses CGAL[2], and all of those library headers are incorporated
> using the create_single_source_cgal_program function in the
> CGAL_CreateSingleSourceCGALProgram.cmake module.
>
> The error messages I’m getting correspond to the ones I get when
> docopt.cpp is not included:
>
> ┌─[*adam*][Hapkido][*±*][docopt *✗*][~/CDT-plusplus/src/docopt]
> └─▪ clang++ --std=c++11 --stdlib=libc++ -I . examples/naval_fate.cpp -o
> naval_fate
> Undefined symbols for architecture x86_64:
>   "docopt::docopt(std::__1::basic_string std::__1::char_traits, std::__1::allocator > const&,
> std::__1::vector,
> std::__1::allocator >,
> std::__1::allocator std::__1::char_traits, std::__1::allocator > > > const&, bool,
> std::__1::basic_string,
> std::__1::allocator > const&, bool)", referenced from:
>   _main in naval_fate-780283.o
>   "docopt::operator<<(std::__1::basic_ostream std::__1::char_traits >&, docopt::value const&)", referenced from:
>   _main in naval_fate-780283.o
> ld: symbol(s) not found for architecture x86_64
> clang: error: linker command failed with exit code 1 (use -v to see
> invocation)
>
> Compare to:
>
> ┌─[*adam*][Hapkido][*±*][docopt *✗*][~/CDT-plusplus]
> └─▪ ./build.sh
> -- The C compiler identification is AppleClang 6.0.0.654
> -- The CXX compiler identification is AppleClang 6.0.0.654
> -- Check for working C compiler using: Ninja
> -- Check for working C compiler using: Ninja -- works
> -- Detecting C compiler ABI info
> -- Detecting C compiler ABI info - done
> -- Check for working CXX compiler using: Ninja
> -- Check for working CXX compiler using: Ninja -- works
> -- Detecting CXX compiler ABI info
> -- Detecting CXX compiler ABI info - done
> -- Build type: Release
> -- USING CXXFLAGS = ' -O3 -DNDEBUG'
> -- USING EXEFLAGS = '
> -Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib
> '
> -- Targetting Ninja
> -- Using /usr/bin/c++ compiler.
> -- DARWIN_VERSION=14
> -- Mac Leopard detected
> -- Requested component: Core
> -- Requested component: MPFR
> -- Requested component: GMP
> -- Found Eigen3: /usr/local/include/eigen3 (found suitable version
> "3.2.2", minimum required is "3.1.0")
> -- Configuring done
> -- Generating done
> -- Build files have been written to: /Users/adam/CDT-plusplus/build
> [10/13] Linking CXX executable cdt-docopt
> FAILED: : && /usr/bin/c++   -O3 -DNDEBUG -Wl,-search_paths_first
> -Wl,-headerpad_max_install_names
> -Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib
> CMakeFiles/cdt-docopt.dir/src/cdt-docopt.cpp.o  -o cdt-docopt
> -L/Users/adam/gmock-1.7.0/lib/.libs
> -L/Users/adam/gmock-1.7.0/gtest/lib/.libs /usr/local/lib/libmpfr.dylib
> /usr/local/lib/libgmp.dylib /usr/local/lib/libCGAL_Core.dylib
> /usr/local/lib/libCGAL.dylib /usr/local/lib/libboost_thread-mt.dylib
> /usr/local/lib/libboost_system-mt.dylib /usr/local/lib/libCGAL_Core.dylib
> /usr/local/lib/libCGAL.dylib /usr/local/lib/libboost_thread-mt.dylib
> /usr/local/lib/libboost_system-mt.dylib
> -Wl,-rpath,/Users/adam/gmock-1.7.0/lib/.libs
> -Wl,-rpath,/Users/adam/gmock-1.7.0/gtest/lib/.libs && :
> Undefined symbols for architecture x86_64:
>   "docopt::docopt(std::__1::basic_string std::__1::char_traits, std::__1::allocator > const&,
> std::__1::vector,
> std::__1::allocator >,
> std::__1::allocator std::__1::char_traits, std::__1::allocator > > > const&, bool,
> std::__1::basic_string,
> std::__1::allocator > const&, bool)", referenced from:
>   _main in cdt-docopt.cpp.o
>   "docopt::operator<<(std::__1::basic_ostream std::__1::char_traits >&, docopt::value const&)", referenced from:
>   _main in cdt-docopt.cpp.o
> ld: symbol(s) not found for architecture x86_64
> clang: error: linker command failed with exit code 1 (use -v to see
> invocation)
> [10/13] Building CXX object
> CMakeFiles/unittests.dir/unittests/Tria

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

2014-12-04 Thread Adam Getchell
Hello all,

I’m trying to use the docopt.cpp parser for my project[1]:

https://github.com/docopt/docopt.cpp 

The usual invocation to build works:

┌─[adam][Hapkido][±][docopt ✗][~/CDT-plusplus/src/docopt]
└─▪ clang++ --std=c++11 --stdlib=libc++ -I . docopt.cpp examples/naval_fate.cpp 
-o naval_fate

So, I want to add docopt.cpp and have the compiler look for header files in the 
same directory, and add that to my executable.

So far, what I’ve attempted is to add the lines:

include_directories (BEFORE "src/docopt")
add_library(docopt.cpp "src/docopt/docopt.cpp”)

My program uses CGAL[2], and all of those library headers are incorporated 
using the create_single_source_cgal_program function in the 
CGAL_CreateSingleSourceCGALProgram.cmake module.

The error messages I’m getting correspond to the ones I get when docopt.cpp is 
not included:

┌─[adam][Hapkido][±][docopt ✗][~/CDT-plusplus/src/docopt]
└─▪ clang++ --std=c++11 --stdlib=libc++ -I . examples/naval_fate.cpp -o 
naval_fate
Undefined symbols for architecture x86_64:
  "docopt::docopt(std::__1::basic_string, 
std::__1::allocator > const&, 
std::__1::vector, 
std::__1::allocator >, std::__1::allocator, std::__1::allocator > > > const&, bool, 
std::__1::basic_string, 
std::__1::allocator > const&, bool)", referenced from:
  _main in naval_fate-780283.o
  "docopt::operator<<(std::__1::basic_ostream 
>&, docopt::value const&)", referenced from:
  _main in naval_fate-780283.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Compare to:

┌─[adam][Hapkido][±][docopt ✗][~/CDT-plusplus]
└─▪ ./build.sh 
-- The C compiler identification is AppleClang 6.0.0.654
-- The CXX compiler identification is AppleClang 6.0.0.654
-- Check for working C compiler using: Ninja
-- Check for working C compiler using: Ninja -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler using: Ninja
-- Check for working CXX compiler using: Ninja -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Build type: Release
-- USING CXXFLAGS = ' -O3 -DNDEBUG'
-- USING EXEFLAGS = '  
-Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib
 '
-- Targetting Ninja
-- Using /usr/bin/c++ compiler.
-- DARWIN_VERSION=14
-- Mac Leopard detected
-- Requested component: Core
-- Requested component: MPFR
-- Requested component: GMP
-- Found Eigen3: /usr/local/include/eigen3 (found suitable version "3.2.2", 
minimum required is "3.1.0") 
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/adam/CDT-plusplus/build
[10/13] Linking CXX executable cdt-docopt
FAILED: : && /usr/bin/c++   -O3 -DNDEBUG -Wl,-search_paths_first 
-Wl,-headerpad_max_install_names 
-Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib
 CMakeFiles/cdt-docopt.dir/src/cdt-docopt.cpp.o  -o cdt-docopt 
-L/Users/adam/gmock-1.7.0/lib/.libs  -L/Users/adam/gmock-1.7.0/gtest/lib/.libs 
/usr/local/lib/libmpfr.dylib /usr/local/lib/libgmp.dylib 
/usr/local/lib/libCGAL_Core.dylib /usr/local/lib/libCGAL.dylib 
/usr/local/lib/libboost_thread-mt.dylib /usr/local/lib/libboost_system-mt.dylib 
/usr/local/lib/libCGAL_Core.dylib /usr/local/lib/libCGAL.dylib 
/usr/local/lib/libboost_thread-mt.dylib /usr/local/lib/libboost_system-mt.dylib 
-Wl,-rpath,/Users/adam/gmock-1.7.0/lib/.libs 
-Wl,-rpath,/Users/adam/gmock-1.7.0/gtest/lib/.libs && :
Undefined symbols for architecture x86_64:
  "docopt::docopt(std::__1::basic_string, 
std::__1::allocator > const&, 
std::__1::vector, 
std::__1::allocator >, std::__1::allocator, std::__1::allocator > > > const&, bool, 
std::__1::basic_string, 
std::__1::allocator > const&, bool)", referenced from:
  _main in cdt-docopt.cpp.o
  "docopt::operator<<(std::__1::basic_ostream 
>&, docopt::value const&)", referenced from:
  _main in cdt-docopt.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[10/13] Building CXX object 
CMakeFiles/unittests.dir/unittests/Triangulated2SphereTest.cpp.o
ninja: build stopped: subcommand failed.

Any suggestions?

[1] https://github.com/acgetchell/CDT-plusplus/tree/docopt 

[2] https://www.cgal.org 

Adam Getchell
about.me/adamgetchell

-- 

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 Consulti

Re: [CMake] project directive overwrites CMAKE_INSTALL_PREFIX?

2014-12-04 Thread J Decker
I find it's better to define CMAKE_INSTALL_PREFIX on the command line when
building

I do have this bit of code...

IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
  SET(CMAKE_INSTALL_PREFIX
${CMAKE_BINARY_DIR}/../${CMAKE_BUILD_TYPE}_out CACHE PATH "Install
default 'out' in this directory." FORCE
)
ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)


which keeps it from overwriting an already set value (from the command
line); and make sure it's in the cache so cmake-gui can edit it...

(if  project() does something with cmake_isnstall_prefix might also be a
bug)

On Thu, Dec 4, 2014 at 7:27 PM, Chris Johnson  wrote:

> I have a global include file used by all of the CMakeLists.txt files in my
> project. In it, I set the value of CMAKE_INSTALL_PREFIX, as well as a
> number of other variables and functions.
>
> In my CMakeLists.txt file, I had this:
>
> cmake_minimum_require(VERSION 2.8.4)
> include(global.inc)
> project(whatever)
>
> When I run cmake, the value of CMAKE_INSTALL_PREFIX is lost! Instead, in
> the resulting cmake_install.cmake file has been defaulted back to
> /usr/local which is completely wrong.
>
> However, if I change the order to this:
>
> cmake_minimum_require(VERSION 2.8.4)
> project(whatever)
> include(global.inc)
>
> It appears to work.
>
> I find nothing in the documentation saying that the project() directive
> will set CMAKE_INSTALL_PREFIX.
>
> Even more strangely, if I run cmake a second time with the first
> configuration (include before project), it will rewrite cmake_install.cmake
> with the correct value.
> ​ ​
> That is, the behavior of cmake appears to be different based on whether
> the build directory is empty or already contains cmake_install.cmake and
> CMakeCache.txt files
> ​, even though they contain the wrong path value for CMAKE_INSTALL_PREFIX.​
>
> What is going on here?
>
>
>
>
>
>
> --
>
> 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://public.kitware.com/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://public.kitware.com/mailman/listinfo/cmake

[CMake] project directive overwrites CMAKE_INSTALL_PREFIX?

2014-12-04 Thread Chris Johnson
I have a global include file used by all of the CMakeLists.txt files in my
project. In it, I set the value of CMAKE_INSTALL_PREFIX, as well as a
number of other variables and functions.

In my CMakeLists.txt file, I had this:

cmake_minimum_require(VERSION 2.8.4)
include(global.inc)
project(whatever)

When I run cmake, the value of CMAKE_INSTALL_PREFIX is lost! Instead, in
the resulting cmake_install.cmake file has been defaulted back to
/usr/local which is completely wrong.

However, if I change the order to this:

cmake_minimum_require(VERSION 2.8.4)
project(whatever)
include(global.inc)

It appears to work.

I find nothing in the documentation saying that the project() directive
will set CMAKE_INSTALL_PREFIX.

Even more strangely, if I run cmake a second time with the first
configuration (include before project), it will rewrite cmake_install.cmake
with the correct value.
​ ​
That is, the behavior of cmake appears to be different based on whether the
build directory is empty or already contains cmake_install.cmake and
CMakeCache.txt files
​, even though they contain the wrong path value for CMAKE_INSTALL_PREFIX.​

What is going on here?
-- 

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://public.kitware.com/mailman/listinfo/cmake

[CMake] Visual Studio 12 C++ Compiler Detection

2014-12-04 Thread Allen Barnett
Hi: I'm trying to create a 64-bit Visual Studio 12 (aka 2013) project with 
CMake 3.0.2. My CMakeLists.txt file is really simple:

cmake_minimum_required( VERSION 3.0 )
project( cmc CXX )
# What compiler did we find?
message( "C++: ${CMAKE_CXX_COMPILER}" )

>From a windows shell I do:

> c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64\vcvars64.bat
> cmake -G "Visual Studio 12 Win64" .
-- The CXX compiler identification is MSVC 18.0.31101.0
-- Check for working CXX compiler using: Visual Studio 12 2013 Win64
-- Check for working CXX compiler using: Visual Studio 12 2013 Win64 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
C++: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/x86_amd64/cl.exe
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/dbarnett/cmc/build

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 the well-known 
"0xc07b" dialog (missing DLL). Unless you've sourced vcvarsx86_amd64.bat, 
the correct environment variables are not set for this version of the compiler.

On the other hand, if I do "cmake -G NMake Makefiles", I get what I expect:

-- The CXX compiler identification is MSVC 18.0.31101.0
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual 
Studio 12.0/VC/bin/amd64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual 
Studio 12.0/VC/bin/amd64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
C++: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/amd64/cl.exe
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/dbarnett/cmc/other

Namely, it finds C:/Program/amd64/cl.exe.

I've looked through the CMake Modules, but I could not really find the place 
where CMake derives the value for CMAKE_CXX_COMPILER when you generate a VS 
project. Could someone point me to the source code where this occurs? I would 
like to see how it is coming up with this version of the compiler which isn't 
even in the PATH.

Thanks,
Allen
-- 

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://public.kitware.com/mailman/listinfo/cmake

Re: [CMake] CMake and 64-bit Systems

2014-12-04 Thread Jakub Zakrzewski
Hallo Michael,

> does CMake run on 64-bit OS (e.g. Ubuntu 14.10 64-bit) without problems or 
> are there some workarounds necessary
> to get it run? If so, is there a description available?

CMake runs smoothly on much more exotic than 64-bit OS, so what makes you think 
it wouldn't work on those?

But let's be clear. It runs without problems on my OpenSUSE, Gentoo, Solaris 
10/11 and Windows 64-bit boxes. Just install / build and off you go.

--
Gruesse,
Jakub


-- 

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://public.kitware.com/mailman/listinfo/cmake


Re: [CMake] CMake and 64-bit Systems

2014-12-04 Thread John Drescher
> does CMake run on 64-bit OS (e.g. Ubuntu 14.10 64-bit) without problems
> or are there some workarounds necessary to get it run? If so, is there a
> description available?
>

I have not had any real issue with cmake (32 or 64 bit binary) on 64
bit linux or windows.

John
-- 

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://public.kitware.com/mailman/listinfo/cmake


[CMake] CMake and 64-bit Systems

2014-12-04 Thread Micha Renner
Hallo,

does CMake run on 64-bit OS (e.g. Ubuntu 14.10 64-bit) without problems
or are there some workarounds necessary to get it run? If so, is there a
description available?

Greetings

Michael





-- 

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://public.kitware.com/mailman/listinfo/cmake