[CMake] cotire and BOOST_PP error

2017-06-11 Thread Olaf Peter

Hello,

to reduce my compile time I try to start with cotire (compile time 
reducer) from https://github.com/sakra/cotire and run into problems 
which I wasn't able to reduce yet. I'm using boost spirit and 
boost.test. The error rises:


[ 62%] Building CXX precompiled header 
sources/_parser_CXX_prefix.hxx.gch

In file included from /tmp/build/sources/..._parser_CXX_prefix.cxx:38:0,
 from /tmp/build/sources/..._parser_CXX_prefix.hxx:4:
/usr/include/boost/preprocessor/iteration/detail/local.hpp:13:6: Fehler: 
#error BOOST_PP_ERROR: local iteration boundaries are not defined

 #error BOOST_PP_ERROR:  local iteration boundaries are not defined
  ^
/usr/include/boost/preprocessor/iteration/detail/local.hpp:34:29: 
Fehler: expected constructor, destructor, or type conversion before »(« 
token

 BOOST_PP_LOCAL_MACRO(0)
 ^
CMake Error at /tmp/ibis/cmake/cotire.cmake:1848 (message):
  cotire: error 1 precompiling
  /tmp/build/sources/..._parser_CXX_prefix.hxx.
Call Stack (most recent call first):
  /tmp/ibis/cmake/cotire.cmake:3521 (cotire_precompile_prefix_header)


The calc9 example from boost.spirit.x3 compiles with cotire and an intro 
example from boost.test also, but failed here. Maybe helpful:


$ cat /tmp/build/sources/..._parser_CXX_prefix.hxx
/* cotire.cmake 1.7.9 generated file */
/* /tmp/build/sources/..._parser_CXX_prefix.hxx */
#ifdef __cplusplus
#include "/tmp/build/sources/..._parser_CXX_prefix.cxx"
#endif

$ cat /tmp/build/...parser_CXX_prefix.cxx
/* cotire.cmake 1.7.9 generated file */
/* /tmp/build/sources/...parser_CXX_prefix.cxx */
#pragma GCC system_header
#ifdef __cplusplus
#include "/usr/include/boost/test/unit_test.hpp"
#include "/usr/include/boost/test/data/test_case.hpp"
#include "/usr/include/boost/filesystem.hpp"
#include "/usr/local/gcc-7.1.0/include/c++/7.1.0/iostream"
#include "/usr/include/boost/core/ignore_unused.hpp"
#include "/usr/include/boost/range.hpp"
#include "/usr/include/boost/variant.hpp"
#include "/usr/include/boost/fusion/include/adapt_struct.hpp"
#include "/usr/include/boost/fusion/support/pair.hpp"
#include "/usr/include/boost/fusion/include/deque.hpp"
#include "/usr/include/boost/tti/has_type.hpp"
#include "/usr/include/boost/tti/has_member_function.hpp"
#include "/usr/include/boost/fusion/include/copy.hpp"
#include "/usr/include/boost/fusion/include/is_sequence.hpp"
#include "/usr/include/boost/fusion/include/size.hpp"
#include "/usr/include/boost/fusion/include/map.hpp"
#include "/usr/include/boost/fusion/include/value_at_key.hpp"
#include "/usr/include/boost/fusion/adapted/mpl.hpp"
#include "/usr/include/boost/mpl/placeholders.hpp"
#include "/usr/include/boost/mpl/filter_view.hpp"
#include "/usr/include/boost/mpl/count_if.hpp"
#include "/usr/include/boost/fusion/include/front.hpp"
#include "/usr/include/boost/fusion/include/move.hpp"
#include "/usr/include/boost/fusion/include/back.hpp"
#include "/usr/include/boost/type_traits/extent.hpp"
#include "/usr/include/boost/cstdint.hpp"
#include "/usr/include/boost/regex/pending/unicode_iterator.hpp"
#include "/usr/local/gcc-7.1.0/include/c++/7.1.0/bitset"
#include "/usr/local/gcc-7.1.0/include/c++/7.1.0/climits"
#include "/usr/local/gcc-7.1.0/include/c++/7.1.0/cctype"
#include "/usr/local/gcc-7.1.0/include/c++/7.1.0/cwctype"
#include "/usr/include/boost/function_types/function_type.hpp"
#include "/usr/include/boost/preprocessor/iteration/local.hpp"
#include "/usr/include/boost/preprocessor/iteration/detail/local.hpp"
#include "/usr/include/boost/config/no_tr1/cmath.hpp"
#include "/usr/include/boost/math/special_functions/fpclassify.hpp"
#include "/usr/include/boost/math/special_functions/sign.hpp"
#include "/usr/include/boost/fusion/include/begin.hpp"
#include "/usr/include/boost/fusion/include/end.hpp"
#include "/usr/include/boost/fusion/include/advance.hpp"
#include "/usr/include/boost/fusion/include/empty.hpp"
#include "/usr/include/boost/fusion/include/iterator_range.hpp"
#include "/usr/include/boost/fusion/include/as_deque.hpp"
#include "/usr/include/boost/fusion/include/mpl.hpp"
#include "/usr/include/boost/mpl/copy_if.hpp"
#include "/usr/include/boost/fusion/include/at.hpp"
#include "/usr/include/boost/locale/encoding_utf.hpp"
#include "/usr/include/boost/test/output_test_stream.hpp"
#include "/usr/include/boost/test/included/unit_test.hpp"
#endif

Maybe here are some with experience with it since without cotire I 
didn't face such problem.



Thanks,

Olaf

--

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 

[CMake] add_custom_command on test input files

2017-04-21 Thread Olaf Peter

Hello,

for my project I have a sub dir with test case which feeds the tests 
'*.input' and allows to check to output '*.expected'. For documentation 
purpose, I have a python script which generates a TestMatrix.rst file. 
Using CMake I have:


dir structure:

$root/{src,include,utils,test}

test/CMakeLists.txt

project(test LANGUAGES CXX)
...

set(TEST_MATRIX_GENERATOR 
${CMAKE_CURRENT_SOURCE_DIR}/../utils/gen_test_matrix.py)
set(TEST_MATRIX_GENERATOR_TARGET 
${CMAKE_CURRENT_SOURCE_DIR}/test_matrix.rst)

file(GLOB_RECURSE TEST_CASE_FILES
LIST_DIRECTORIES true
"${CMAKE_CURRENT_SOURCE_DIR}/test_case/" "*.expected"
)
add_custom_command(
TARGET  ${PROJECT_NAME} POST_BUILD
COMMAND ${TEST_MATRIX_GENERATOR} ${CMAKE_CURRENT_SOURCE_DIR} > 
${TEST_MATRIX_GENERATOR_TARGET}

DEPENDS ${TEST_MATRIX_GENERATOR} ${TEST_CASE_FILES}
BYPRODUCT ${TEST_MATRIX_GENERATOR_TARGET}
COMMENT "Generate TestCase Matrix (RST)"
)

set_source_files_properties(
${TEST_MATRIX_GENERATOR_TARGET}
PROPERTIES GENERATED TRUE
)

but I assume, this isn't clever since it doesn't depend on the test_case 
dirs/files as I've seen so far. Changes in these file doesn't trigger 
the generation process, removing the ${TEST_MATRIX_GENERATOR_TARGET} 
doesn't recreate it. How to get it working/generating on each changes 
(additions) of the files/dirs in test_case?



Thanks,

Olaf

--

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] Linker error with sub project's static libs

2014-08-22 Thread Olaf Peter

Hello Leif,

 Are your libraries mutually dependent?  You may be hitting the
 mutually-dependent static library problem.  Look for the word 
mutual near

 the end of
 http://www.cmake.org/cmake/help/v3.0/command/target_link_libraries.html,
 that section explains some of what is going on.

yes it is mutually, ui_lib creates a SchematicView, which is derived 
from GraphicView. SchematicView's instance is in ui_schematic_lib, where 
GraphicsView is in ui_lib. Probably I should stay the files inside these 
directory and add them to the source in ui_lib project as the docs 
suggested.


Thanks,
Olaf

 Unless your code snippets are incomplete, I'm missing the following
 statement in ./source/eea/ui/CMakeLists.txt

   target_link_libraries(eea_ui_lib
   eea_ui_schematic_lib)

 I'm not sure this is causing the link error, but it's worth a try.

 thank you a lot, this solves the linker problem - I have to add these
 twice, reference to the other lib each time.


 Furthermore, I think the order of add_subdirectory(), 
add_library(), and

 target_link_libraries() is important. You might want to check those as
 well.

 The order matches of course, but I haven't never such linker 
problems. The
 first time I'm using target_link_lib for a library self. The reason 
is not

 clear for me. What happens under the hood here?


 Thanks,
 Olaf

 --

 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


Re: [CMake] Linker error with sub project's static libs

2014-08-21 Thread Olaf Peter
no idea here? It's seems to be a C++ problem, but how to solve it. 
Changing the order of


 target_link_libraries(eea
  eea_ui_schematic_lib
  eea_ui_lib

to

 target_link_libraries(eea
  eea_ui_lib
  eea_ui_schematic_lib

makes it even worser - more unresolved symbols. So what happens here?


for my project I have the following structure in my project directory:

./CMakeLists.txt
./source/CMakeLists.txt
./source/eea/CMakeLists.txt
./source/eea/ui/CMakeLists.txt
./source/eea/ui/schematic/CMakeLists.txt

with
---8---
./CMakeLists.txt:
project(eea)
...

---8---
./source/CMakeLists.txt:
add_subdirectory(eea)
...

---8---
./source/eea/CMakeLists.txt
add_executable(eea ...)

target_link_libraries(eea
 eea_ui_schematic_lib
 eea_ui_lib
 ...
)

qt5_use_modules(eea Widgets ...)

add_subdirectory(ui)
...

---8---
./source/eea/ui/CMakeLists.txt
project(eea_ui)
...
set(eea_ui_SOURCE mainwindow_private.cpp graphics_view.cpp...)
add_library(eea_ui_lib STATIC
 ${eea_ui_SOURCE}
 ...
)

qt5_use_modules(eea_ui_lib Widgets ...)

add_subdirectory(schematic)
...
---8---
./source/eea/ui/schematic/CMakeLists.txt:
project(eea_ui_schematic)
...
set(eea_ui_schematic_SOURCE schematics_view.cpp ...)
add_library(eea_ui_schematic_lib STATIC
 ${eea_ui_schematic_SOURCE}
 ...
)

qt5_use_modules(eea_ui_schematic_lib Widgets ...)

So far, so good - all compiles.



With
---8---
./source/eea/ui/mainwindow_private.cpp :
...
createWindows() {
 SchematicView* schematicView = new SchematicView(q);
 ...
}

---8---
./source/eea/ui/graphics_view.cpp:
GraphicsView::GraphicsView(QWidget* parent) { ...  }

---8---
./source/eea/ui/schematic/schematic_view.cpp
class SchematicView
: public GraphicsView
{  }


I got the linker error:

../../lib/libeea_ui_lib.a(mainwindow_private.cpp.o): In function
`eea::ui::MainWindowPrivate::createWindows()':
mainwindow_private.cpp:(.text+0xbb): warning: undefined reference to
`eea::ui::SchematicView::SchematicView(QWidget*)'

So, what happened here and how to solve it? Before the contents of
ui/schematic moved into the ui directory/project and I've got no errors.

Thanks,
Olaf


--

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] Linker error with sub project's static libs

2014-08-21 Thread Olaf Peter

Hello Marcel,

Olaf,

Unless your code snippets are incomplete, I'm missing the following
statement in ./source/eea/ui/CMakeLists.txt

 target_link_libraries(eea_ui_lib
 eea_ui_schematic_lib)

I'm not sure this is causing the link error, but it's worth a try.
thank you a lot, this solves the linker problem - I have to add these 
twice, reference to the other lib each time.


Furthermore, I think the order of add_subdirectory(), add_library(), and
target_link_libraries() is important. You might want to check those as well.
The order matches of course, but I haven't never such linker problems. 
The first time I'm using target_link_lib for a library self. The reason 
is not clear for me. What happens under the hood here?


Thanks,
Olaf

--

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] Linker error with sub project's static libs

2014-08-19 Thread Olaf Peter

Hello,

for my project I have the following structure in my project directory:

./CMakeLists.txt
./source/CMakeLists.txt
./source/eea/CMakeLists.txt
./source/eea/ui/CMakeLists.txt
./source/eea/ui/schematic/CMakeLists.txt

with
---8---
./CMakeLists.txt:
project(eea)
...

---8---
./source/CMakeLists.txt:
add_subdirectory(eea)
...

---8---
./source/eea/CMakeLists.txt
add_executable(eea ...)

target_link_libraries(eea
eea_ui_schematic_lib
eea_ui_lib
...
)

qt5_use_modules(eea Widgets ...)

add_subdirectory(ui)
...

---8---
./source/eea/ui/CMakeLists.txt
project(eea_ui)
...
set(eea_ui_SOURCE mainwindow_private.cpp graphics_view.cpp...)
add_library(eea_ui_lib STATIC
${eea_ui_SOURCE}
...
)

qt5_use_modules(eea_ui_lib Widgets ...)

add_subdirectory(schematic)
...
---8---
./source/eea/ui/schematic/CMakeLists.txt:
project(eea_ui_schematic)
...
set(eea_ui_schematic_SOURCE schematics_view.cpp ...)
add_library(eea_ui_schematic_lib STATIC
${eea_ui_schematic_SOURCE}
...
)

qt5_use_modules(eea_ui_schematic_lib Widgets ...)

So far, so good - all compiles.



With
---8---
./source/eea/ui/mainwindow_private.cpp :
...
createWindows() {
SchematicView* schematicView = new SchematicView(q);
...
}

---8---
./source/eea/ui/graphics_view.cpp:
GraphicsView::GraphicsView(QWidget* parent) { ...  }

---8---
./source/eea/ui/schematic/schematic_view.cpp
class SchematicView
: public GraphicsView
{  }


I got the linker error:

../../lib/libeea_ui_lib.a(mainwindow_private.cpp.o): In function 
`eea::ui::MainWindowPrivate::createWindows()':
mainwindow_private.cpp:(.text+0xbb): warning: undefined reference to 
`eea::ui::SchematicView::SchematicView(QWidget*)'


So, what happened here and how to solve it? Before the contents of 
ui/schematic moved into the ui directory/project and I've got no errors.


Thanks,
Olaf
--

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] CDT generator help: path discovery and other items

2013-06-04 Thread Olaf Peter

Eclipse does have some issues, where cmake simply cannot help.
Some settings are stored neither in the .project nor in the .cproject files,
but inside the workspace metedata, which cmake cannot touch (because it is
somewhere else, it is binary, undocumented, etc.).


What are this for issues? Where are they documented? I have the problem, 
that code completion doesn't work, a huge eclispse error marker are 
shown due to the fact, that includes are not indexed? by eclipse. The 
includes has /usr/local/include paths e.g. The cmake project compiles 
fine since the includes are set correctly for make.


I've a source and sibling build dir and using hg/svn.


Also, Eclipse only open the version control plugins inside the project
directory. Now with cmake out-of-source builds the project files for Eclipse
are generated in the build tree, not in the source tree, and Eclipse doesn't
see version control files there, so it never opens the version control
plugins. I would naively assume that it shouldn't be too hard to add an entry
SourceRootDir or something like that to the .project file, which, if set,
would then be used instead of the directory of .project. Then cmake could
simply write that tag into the .project file and Eclipse would be able to
handle it. But for that it needs somebody deep in Eclipse to add support for
that inside Eclipse.


since cmake is able to create a source project to, all version control 
has to be there, finaly haaving a build dir with virtual folder for the 
source and the source dir for versioning. Not fine, but works.


Regards,
Olaf
--

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 at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


[CMake] compiler defines for sub projects

2013-04-05 Thread Olaf Peter

Hello,

is it possible to inherit compiler defines for sub projects in sub 
directories?


I have a library project which can be configured at compile time using 
preprocessor defines (cmake option)


option(FOO_OPTION enable foo OFF)
option(BAR_OPTION enable bar OFF)


if(FOO_OPTION)
set_target_properties(my_lib PROPERTIES COMPILE_DEFINITIONS FOO_X )
elseif(BAR_OPTION)
set_target_properties(my_lib PROPERTIES COMPILE_DEFINITIONS FOO_Y)
else()
set_target_properties(my_lib PROPERTIES COMPILE_DEFINITIONS OTHER )
endif()

now, in the sub of this I have unit tests which need to know about this 
compile defs, hence I have the same if/else again.


Is there an easy way for this?

Thanks,
Olaf
--

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 at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


[CMake] Dependencies of generated files

2013-02-13 Thread Olaf Peter

Hello,

obviously I have a problem with the understanding of generating 
dependencies of generated files.


generate_foo_static_lexer is using ${foo_LEXER_HPP} to generate a header 
file ${foo_STATIC_LEXER_HPP}. Each time ${foo_STATIC_LEXER_HPP} is 
changed the header shall be regenerated. Later, ${foo_STATIC_LEXER_HPP} 
can be more than one file (maybe list(xxx_HPP A;B;C)?? ).


But this doesn't happen, only the exe is re-created. What's wrong?

project(foo)

# generate foo's static lexer into the root of out-of-source build directory
set(foo_INCLUDE_PATH ${CMAKE_BINARY_DIR}/include/foo/io/foo)
set(foo_STATIC_LEXER_HPP ${foo_INCLUDE_PATH}/foo_static_lexer.hpp)
file(MAKE_DIRECTORY ${foo_INCLUDE_PATH})
set(foo_LEXER_HPP ${CMAKE_SOURCE_DIR}/include/foo/io/foo/lexer_impl.hpp)

add_executable(generate_foo_static_lexer generate_foo_static_lexer.cpp)
set_target_properties(generate_foo_static_lexer PROPERTIES 
COMPILE_DEFINITIONS foo_LEXER_DYNAMIC_TABLES;BOOST_SPIRIT_LEXERTL_DEBUG)


add_custom_command(
   OUTPUT  ${foo_STATIC_LEXER_HPP}
   COMMAND generate_foo_static_lexer ${foo_STATIC_LEXER_HPP}
   COMMENT Generating foo static DFA lexer header ${foo_STATIC_LEXER_HPP}
   )
add_custom_target(foo_dfa DEPENDS ${foo_LEXER_HPP})
add_dependencies(foo_dfa generate_foo_static_lexer)
set_source_files_properties(${foo_STATIC_LEXER_HPP} PROPERTIES GENERATED 1)
--

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 at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


[CMake] Question about generate a source file during the build

2013-02-03 Thread Olaf Peter

Hi,

I've read the FAQ hopefully carefully. But I did run into a problem with 
a out-of-source-build:


---8---
project(coolcoding)

# generate coolcoding's static lexer
set(COOLCODING_BAR_HPP 
${PROJECT_BINARY_DIR}/include/foo/io/coolcoding/coolcoding_bar.hpp)


add_executable(generate_coolcoding_bar generate_coolcoding_bar.cpp)

add_custom_command(
   OUTPUT  ${COOLCODING_BAR_HPP}
   COMMAND generate_coolcoding_bar ${COOLCODING_BAR_HPP}
   )

add_custom_target(coolcoding_dfa DEPENDS ${COOLCODING_BAR_HPP})

set_source_files_properties(${COOLCODING_BAR_HPP} PROPERTIES GENERATED 1)
---8---

The generation failed due to the fact, that I want to generate into 
${PROJECT_BINARY_DIR}/include/foo/io/ the header.


The source file simply holds:

---8---
int main(int argc, char* argv[])
{
...
std::ofstream out(argc  2 ? coolcoding_bar.hpp : argv[1]);
...
---8---

What is the recommended way the generate header not in the source-build 
dir self (means where the generate_coolcoding_bar.cpp is placed)?


For the project self I have therefore to include $source/include and 
$build/include.


Thanks,
Olaf
--

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 at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Question about generate a source file during the build

2013-02-03 Thread Olaf Peter

Hi Sébastien,

   ---8---
   project(coolcoding)
  
   # generate coolcoding's static lexer
   set(COOLCODING_BAR_HPP
 ${PROJECT_BINARY_DIR}/include/foo/io/coolcoding/coolcoding_bar.hpp)
  
   add_executable(generate_coolcoding_bar generate_coolcoding_bar.cpp)
  
   add_custom_command(
  OUTPUT  ${COOLCODING_BAR_HPP}
  COMMAND generate_coolcoding_bar ${COOLCODING_BAR_HPP}
  )

 You might want to add

 DEPENDS generate_coolcoding_bar

 to this command.


IMO the DEPENDS is only useful if you have an input file dependency, 
which isn't here the case.


file(MAKE_DIRECTORY ${directory})

did help, but is verbose since I use set(DIR ...) and set(HPP 
${DIR}/...). It would be nice if cmake would know that there is a 
directory to create


Thanks,
Olaf


--

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 at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


[CMake] Top-Level Project with libs and unit test

2010-03-26 Thread Olaf Peter
Hi,

I've a top level project which is using Qt. Therefore I've a lot of
defines and compiler switches on.
Further more, there is an of Qt independent library with unit tests.

$ cat project/CMakeLists.txt
...
add_definitions(-DQT_NO_KEYWORDS)
add_definitions(-DQT_NO_CAST_FROM_ASCII)
add_definitions(-DQT_NO_CAST_TO_ASCII)
...

$ cat project/molp/CMakeLists.txt
project(molp)
set(molp_SOURCES grammar.cpp)
add_library(molp STATIC ${molp_SOURCES})
add_subdirectory(test)

$ cat project/molp/test/CMakeLists.txt
project(molp_unit_test)
set(CMAKE_CXX_FLAGS -g) # wont' work
set(molp_ut_SOURCES test.cpp )

add_executable( molp_ut ${molp_ut_SOURCES} )
target_link_libraries( molp_ut molp )
add_test(
  NAMEmolp
  COMMAND molp_ut --run_test=all )

How to set the compiler defines/switches for the  sub-projects?

Thanks,
Olaf

___
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 at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


[CMake] Qt - Private implementation slot and required cmake special rules

2010-03-03 Thread Olaf Peter
I try to use Qt's internal Stuff for my own purpose. I want to compile
the moc file separately which is with cmake very simple. Anyway, I have
to tweak moc for this.

I have to add the private type to the moc file generated otherwise I get
an compiler error about incomplete type (the public header forwards
only the private), in this case simple by e.g.

/usr/bin/moc-qt4 -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
-I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore
-I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. slotTest.h
-fslotTest_p.h -o moc_slotTest.cpp

Note the -fslotTest_p.h

Now I've the private header included, but how to say this for cmake for
the general case?? QT4_WRAP_CPP allows addition options, but how to get
the private header?

Thanks,
Olaf
___
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 at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Qt - Private implementation slot and required cmake special rules

2010-03-03 Thread Olaf Peter
John Drescher schrieb:
 On Wed, Mar 3, 2010 at 1:37 PM, Olaf Peter ope-de...@gmx.de wrote:
 I try to use Qt's internal Stuff for my own purpose. I want to compile
 the moc file separately which is with cmake very simple. Anyway, I have
 to tweak moc for this.

 I have to add the private type to the moc file generated otherwise I get
 an compiler error about incomplete type (the public header forwards
 only the private), in this case simple by e.g.

 /usr/bin/moc-qt4 -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
 -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore
 -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. slotTest.h
 -fslotTest_p.h -o moc_slotTest.cpp

 Note the -fslotTest_p.h

 Now I've the private header included, but how to say this for cmake for
 the general case?? QT4_WRAP_CPP allows addition options, but how to get
 the private header?

 
 Use QT4_AUTOMOC in these cases.

Well, QT4_AUTOMOC requires #include foo.moc which I don't want.

Thanks,
Olaf
___
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 at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] adding extra target to CMakeLists.txt

2010-02-11 Thread Olaf Peter
Tyler Roscoe schrieb:
 On Wed, Feb 10, 2010 at 09:08:50PM +0100, Olaf Peter wrote:
 How can I add an extra lint/syntax check target for my executable, like:

 check-syntax:
  c++ -o /dev/null ${CXX_FLAGS} ${CXX_DEFINES} -S ${MY_PROJECT_SOURCES}
 .PHONY: check-syntax
 
 You'll want to look at add_custom_command() and maybe
 add_custom_target(). The FAQ has some examples you can look to as well.

I did try it and it doesn't work:

---8--- CMakeList.txt
add_custom_target (syntax-check
  COMMAND ${CXX} CHECK_SRC)

---8 build/src/Makefile

# Convenience name for target.
src/CMakeFiles/syntax-check.dir/rule:
cd /home/olaf/Projects/programming/cpp/build  $(MAKE) -f
CMakeFiles/Makefile2 src/CMakeFiles/syntax-check.dir/rule
.PHONY : src/CMakeFiles/syntax-check.dir/rule

# Convenience name for target.
syntax-check: src/CMakeFiles/syntax-check.dir/rule
.PHONY : syntax-check

# fast build rule for target.
syntax-check/fast:
cd /home/olaf/Projects/programming/cpp/build  $(MAKE) -f
src/CMakeFiles/syntax-check.dir/build.make
src/CMakeFiles/syntax-check.dir/build
.PHONY : syntax-check/fast


It shall be equivilanet to a 'lint' target.

Thanks,
Olaf
___
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 at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] adding extra target to CMakeLists.txt

2010-02-11 Thread Olaf Peter
OK, now I have it:

add_custom_target (syntax-check
 COMMAND $(CXX) $(CXXFLAGS) -Wall -Wextra -pedantic -fsyntax-only
$(CHECK_SRC) VERBATIM)


But how can I get there the Defines and Includes from regular target
compile?

Thanks,
Olaf
___
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 at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


[CMake] adding extra target to CMakeLists.txt

2010-02-10 Thread Olaf Peter
How can I add an extra lint/syntax check target for my executable, like:

check-syntax:
c++ -o /dev/null ${CXX_FLAGS} ${CXX_DEFINES} -S ${MY_PROJECT_SOURCES}
.PHONY: check-syntax

to make created Makefile??

thanks,
Olaf

___
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 at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


[CMake] CMake, Qt and Boost.signals

2010-02-01 Thread Olaf Peter
Hi,

following
http://www.boost.org/doc/libs/1_41_0/doc/html/signals/s04.html#id1677853
I can mix Qt and Boost.Signals if I add

CONFIG  += no_keywords

to to qmkae projectfile. How can I get it with cmake?

Reagrds,
Olaf
___
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 at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


[CMake] convert variable from hex to integer

2008-09-19 Thread Olaf Peter

Hi,

for a generated version header I need to convert a given hex to an 
integer. I've wrote:


set(RELEASE_LEVEL_ALPHA 0xA)# For internal use
set(RELEASE_LEVEL_BETA  0xB)# For internal use
set(RELEASE_LEVEL_GAMMA 0xC)# For release candidates
set(RELEASE_LEVEL_FINAL 0xF)# For final release

set(VERSION_MAJOR 0)
set(VERSION_MINOR 1)
set(VERSION_MICRO 0)
set(RELEASE_LEVEL ${RELEASE_LEVEL_ALPHA})
set(RELEASE_SERIAL 0)

in CMakeLists.txt and in version.h.cmake:

enum {
MAJOR  = (@VERSION_MAJOR@  24),
MINOR  = (@VERSION_MINOR@  16),
MICRO  = (@VERSION_MICRO@   8),
RELEASE_LEVEL  = (@RELEASE_LEVEL@   4),
RELEASE_SERIAL = (@RELEASE_SERIAL@   0),
VERSION= MAJOR | MINOR | MICRO | RELEASE_LEVEL | 
RELEASE_SERIAL

};

which results into:

enum {
MAJOR  = (0  24),
MINOR  = (1  16),
MICRO  = (0   8),
RELEASE_LEVEL  = (0xA   4),
RELEASE_SERIAL = (0   0),
VERSION= MAJOR | MINOR | MICRO | RELEASE_LEVEL | 
RELEASE_SERIAL

};

The 0xA doesn't compile.

Thanks,
Olaf
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


[CMake] Eclipse Generator: build specific environment variables

2008-08-18 Thread Olaf Peter
Hi,

how can I set environment variables for eclipse? cmakelist.txt is
configured http://www.cmake.org/Wiki/CMake:Eclipse: Parsing Errors more
efficiently. Anyway, it seems the parser expect english :-) How can I
set the environment variable LANG=en for compiler or make fot he
build/compiler process?

Thanks,
Olaf
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


[CMake] cmake 2.6.1 with generator for eclipse problem

2008-08-06 Thread Olaf Peter
Hi,

the following command line works as expected (out of source build):

$ ../cmake-2.6.1-Linux-i386/bin/cmake ../project
-- The C compiler identification is GNU
...
-- Configuring done
-- Generating done
-- Build files have been written to: /home/olaf/build

but:

$ ../cmake-2.6.1-Linux-i386/bin/cmake -G Eclipse CDT4 - Unix Makefiles
../project/
-- The C compiler identification is GNU
...
-- Configuring done
Aborted

What happend here? Is this a known Problem? In real I append
-DECLIPSE_CDT4_GENERATE_SOURCE_PROJECT=TRUE has described in the wiki.

Regards,
Olaf
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


[CMake] FindQt

2008-07-10 Thread Olaf Peter
Hi,

it would be great if FindQt (resp. FindQt4) would support a user file
extension for QT4_WRAP_UI, e.h. hpp for the ui header. *.hpp is a common
C++ header extension as I use it for my code.

Thanks,
Olaf
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake