[CMake] build step is not thread-safe for CMake

2020-02-10 Thread hex

hello,


My build step is not thread-safe (the instruction in the COMMAND part). 
Every build step depends on one source file:



/add_custom_command(//
//    DEPENDS on_source.file//
//    OUTPUT//
//    object_file_for_source_file//
//    COMMAND not-thread-safe-compiler --build on_source.file//
//    COMMENT//
//            "Building Source object"//
//)/


add_custom_target DEPENDS on OUTPUT from all custom command's, but in 
order to prevent parallel execution when cmake is called:



/cmake --build . --target all -j30/


I need to build each step in any order, but still not as a dependency as 
this would trigger unnecessary recompilation. Using MAIN_DEPENDENCY 
defines hierarchical dependency, but this won't help in this situation.



I cannot figure out how to prevent parallel execution of COMMAND in 
CMake. The only option I see is a single command



/add_custom_target(tgt//
//    DEPENDS on_all_source.files//
//    COMMAND not-thread-safe-compiler --build on_source1.file/

/    COMMAND not-thread-safe-compiler --build on_source2.file/

/    COMMAND not-thread-safe-compiler --build on_source3.file/

/    . . .//
/

/    COMMENT//
//            "Building target"//
//)/


this would rebuild every source, though.


How do I set this up?


thank you

-- 

Powered by kitware.com/cmake

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit https://cmake.org/services

Visit other Kitware open-source projects at https://www.kitware.com/platforms

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

This mailing list is deprecated in favor of https://discourse.cmake.org


[CMake] Dependencies of an external project

2019-11-19 Thread hex
I have an external CMake project that gets exported on install. The root 
project uses it as a package. The external project must be installed 
prior being used as a package.


I can solve this problem by using `ExternalProject` for both projects 
and declare their dependency. My setup is different, though, as the root 
project depends on an external project. Since I am including the 
external project without it having installed on system I am not sure if 
it is correct to use the package as downstream or whether upstream 
should be applied instead.



Consider the following project structure:

my_test
├── cmake
├── extern
│   └── mylibrary
│   ├── cmake
│   ├── include
│   │   └── my_library
│   └── src
├── include
│   └── my_test
└── src

`mylibrary` is a standalone project with `export` on install to use its 
library as package.


`my_test` (root) is another project that depends on `mylibrary`.

CMakeLists.txt:
```
# add dependencies
add_subdirectory( extern )
add_subdirectory( src )
```

extern/CMakeLists.txt:
```
ExternalProject_Add(mylibrary
    CMAKE_ARGS
    -D CMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}
    SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/mylibrary"
)
```

src/CMakeLists.txt:
```c
list( APPEND CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}" )

find_package( my_library REQUIRED )

#=
# Define targets
#=
add_executable( MyTestProject test.cpp )
add_dependencies(MyTestProject my_library-exportname)
target_link_libraries( MyTestProject PUBLIC my_library-exportname)
```

I added `add_dependencies` to have `my_library` be installed prior to 
building `my_test`. However, build fails even before that since I have 
`find_package()` in the same CMake txt file.


*How can I setup my install as dependency for a package?*

-- 

Powered by kitware.com/cmake

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit https://cmake.org/services

Visit other Kitware open-source projects at https://www.kitware.com/platforms

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

This mailing list is deprecated in favor of https://discourse.cmake.org


Re: [CMake] file dependency not working in external projects

2019-09-24 Thread hex


hello Eric Doenges,

You are correct. This has been given me headaches.

Setting BUILD_ALWAYS to TRUE gives the desired behaviour.


Thank you


On 24/09/2019 14:59, Eric Doenges wrote:


You're probably missing the BUILD_ALWAYS option to ExternalProject_Add:

|BUILD_ALWAYS |
Enabling this option forces the build step to always be run. This
can be the easiest way to robustly ensure that the external
project’s own build dependencies are evaluated rather than relying
on the default success timestamp-based method. This option is not
normally needed unless developers are expected to modify something
the external project’s build depends on in a way that is not
detectable via the step target dependencies (e.g. |SOURCE_DIR| is
used without a download method and developers might modify the
sources in |SOURCE_DIR|).
Am 24.09.19 um 15:23 schrieb hex:

hello,

I have a problem with a build step.

The following command is run every time somefile changes:

add_custom_command( OUTPUT out.put
    COMMAND touch out.put
    DEPENDS somefile.txt
)

add_custom_target( sometarget DEPENDS out.put )


I move this snippet inside an external project (with 
ExternalProject_Add) and the custom command is only run once at build.


I am using absolute path to somefile, the command is not rebuild 
changing somefile.


I am using Gnu make generator and build with make all


What am I missing?


--

*Dr. Eric Dönges*
Senior Software Engineer

MVTec Software GmbH | Arnulfstr. 205 | 80634 Munich | Germany
doen...@mvtec.com <mailto:musterm...@mvtec.com> | Tel: +49 89 457 
695-0 | www.mvtec.com <http://www.mvtec.com>


Find our privacy policy here <https://www.mvtec.com/imprint>.

Sign up <https://www.mvtec.com/newsletter> for our MVTec Newsletter!

Geschäftsführer: Dr. Wolfgang Eckstein, Dr. Olaf Munkelt
Amtsgericht München HRB 114695

MVTec Software GmbH Logo

-- 

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] file dependency not working in external projects

2019-09-24 Thread hex

hello,

I have a problem with a build step.

The following command is run every time somefile changes:

add_custom_command( OUTPUT out.put
    COMMAND touch out.put
    DEPENDS somefile.txt
)

add_custom_target( sometarget DEPENDS out.put )


I move this snippet inside an external project (with 
ExternalProject_Add) and the custom command is only run once at build.


I am using absolute path to somefile, the command is not rebuild 
changing somefile.


I am using Gnu make generator and build with make all


What am I missing?

--

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] modify cmake build arguments

2019-08-30 Thread hex
It does work after setting CMAKE_C_SOURCE_FILE_EXTENSIONS inside the 
override. It should be set in a CMakeDetermineCompiler file though. I'll 
add language support for it next.



As a side note, wouldn't it be better to replace

CMake/Modules/CMakeCCompiler.cmake.in:

/set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m)/


with:

/list(APPEND CMAKE_C_SOURCE_FILE_EXTENSIONS c;m )/

?


On 30/08/2019 12:41, hex wrote:
I am still facing a problem: The build step is skipped only the link 
step is performed (I missed that in the beginning). It seems like the 
build step does not have any dependencies.



This is because different file extension are used. I cannot set 
CMAKE_C_SOURCE_FILE_EXTENSIONS because I believe `project` redefines 
the variable. If I set it afterwards it does not take effect. For now 
it works if I change the source file extension.


-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] modify cmake build arguments

2019-08-30 Thread hex
I am still facing a problem: The build step is skipped only the link 
step is performed (I missed that in the beginning). It seems like the 
build step does not have any dependencies.



This is because different file extension are used. I cannot set 
CMAKE_C_SOURCE_FILE_EXTENSIONS because I believe `project` redefines the 
variable. If I set it afterwards it does not take effect. For now it 
works if I change the source file extension.


--

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] modify cmake build arguments

2019-08-30 Thread Hex
thank you this is exactly what I am looking for. It is working well.

From the documentation:

«It is loaded after CMake’s builtin compiler and platform information
modules have been loaded but before the information is used.»

since CMakeCInformation.cmake:

# compile a C file into an object file
if(NOT CMAKE_C_COMPILE_OBJECT)
  set(CMAKE_C_COMPILE_OBJECT
"-o-c ")
endif()


CMAKE_USER_MAKE_RULES_OVERRIDE_C must be set before the language is set,
i.e. before any `enable_language()` or `project()` instruction.



--
Sent from: http://cmake.3232098.n2.nabble.com/
-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] modify cmake build arguments

2019-08-30 Thread hex

thank you this is exactly what I am looking for. It is working well.

From the documentation:

«It is loaded after CMake’s builtin compiler and platform information 
modules have been loaded but before the information is used.»


since CMakeCInformation.cmake:

# compile a C file into an object file
if(NOT CMAKE_C_COMPILE_OBJECT)
  set(CMAKE_C_COMPILE_OBJECT
    "-o    -c 
")

endif()


CMAKE_USER_MAKE_RULES_OVERRIDE_C must be set before the language is set, 
i.e. before any `enable_language()` or `project()` instruction.



On 30/08/2019 06:47, Eric Doenges wrote:


The way I understand the documentation, CMAKE_USER_MAKE_RULES_OVERRIDE 
applies for all generators, not just the Makefile one. What you are 
apparently supposed to do is create a file that sets all the "rule 
variables" as required (in this case, CMAKE_C_COMPILE_OBJECT), and 
then include that file via CMAKE_USER_MAKE_RULES_OVERRIDE. I'm not 
sure if these 'rule variables' are documented anywhere - but you can 
look into "installed>/share/cmake-/Modules/Compiler" for inspiration. 
Another good starting point would be 
"<...>/share/cmake-/Modules/CMakeCInformation.cmake".


With kind regards,
Eric

*Dr. Eric Dönges *
Senior Software Engineer

MVTec Software GmbH | Arnulfstr. 205 | 80634 Munich | Germany
doen...@mvtec.com  | Tel: +49 89 457 695-0 | 
www.mvtec.com 


Sign up  for our MVTec Newsletter!

Geschäftsführer: Dr. Wolfgang Eckstein, Dr. Olaf Munkelt
Amtsgericht München HRB 114695

MVTec Software GmbH Logo

-- 

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] Fwd: modify cmake build arguments

2019-08-30 Thread hex

thank you this is exactly what I am looking for. It is working well.

From the documentation:

«It is loaded after CMake’s builtin compiler and platform information 
modules have been loaded but before the information is used.»


since CMakeCInformation.cmake:

# compile a C file into an object file
if(NOT CMAKE_C_COMPILE_OBJECT)
  set(CMAKE_C_COMPILE_OBJECT
    "-o    -c 
")

endif()


CMAKE_USER_MAKE_RULES_OVERRIDE_C must be set before the language is set, 
i.e. before any `enable_language()` or `project()` instruction.



On 30/08/2019 06:47, Eric Doenges wrote:


The way I understand the documentation, CMAKE_USER_MAKE_RULES_OVERRIDE 
applies for all generators, not just the Makefile one. What you are 
apparently supposed to do is create a file that sets all the "rule 
variables" as required (in this case, CMAKE_C_COMPILE_OBJECT), and 
then include that file via CMAKE_USER_MAKE_RULES_OVERRIDE. I'm not 
sure if these 'rule variables' are documented anywhere - but you can 
look into "installed>/share/cmake-/Modules/Compiler" for inspiration. 
Another good starting point would be 
"<...>/share/cmake-/Modules/CMakeCInformation.cmake".


With kind regards,
Eric

*Dr. Eric Dönges *
Senior Software Engineer

MVTec Software GmbH | Arnulfstr. 205 | 80634 Munich | Germany
doen...@mvtec.com  | Tel: +49 89 457 695-0 | 
www.mvtec.com 


Sign up  for our MVTec Newsletter!

Geschäftsführer: Dr. Wolfgang Eckstein, Dr. Olaf Munkelt
Amtsgericht München HRB 114695

MVTec Software GmbH Logo

-- 

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] modify cmake build arguments

2019-08-29 Thread hex

hello community,


CMake builds a C project with /gcc -o target_name/. I have a compiler 
very similar to GCC and I am trying configure CMake C language for it.



The compiler does not support the -o argument when linking objects. I 
wonder if there is a way to remove or modify this argument, maybe 
through one of the properties on targets?



thank you

-- 

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] import objects to CMake

2019-07-23 Thread hex

hello community,

Following an example on the usage of IMPORTED_OBJECTS from the book 
"Professional CMake"


I receive the following error:

/Error evaluating generator expression://
//
//    $//
//
//  Expression did not evaluate to a known generator expression/


I wonder if there is a mistake in the code snippet? I was able to make 
it work using TARGET_OBJECTS instead of TARGET_SOURCES (CMake 3.15).


this is the original CMakeLists.txt:

add_library(myObjLib OBJECT IMPORTED)
set_target_properties(myObjLib PROPERTIES
   IMPORTED_OBJECTS /some/path/obj1.obj
    /some/path/obj2.obj
)

add_executable(myExe $)


-- 

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] add my own language-name using standard functions

2019-07-19 Thread hex

dear community,

I want to make a module for a language that is not supported by CMake.

are there any restrictions in using *add_executable* for any language 
other than C / C++,


must the build be constructed very similar to C language?

I was looking into Java module for reference and noted that it is 
defining its own functions for build. Since overriding standard CMake 
functions is discouraged and *add_executable* seems to be hard coded 
(not a CMake module) I believe that I have to create my own functions 
like add_verilog_configuration, target_link_verilog_library and alike.



-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] relative path to toolchain does not work

2019-07-19 Thread hex
Yes, this was the problem. I was running cmake .. -LA to check the cache 
variables /before/ setting the toolchain. You can even see that the 
CMAKE_TOOLCHAIN_FILE is not set.


It is working now, thank you.


On 17/07/2019 18:12, Robert Maynard wrote:

Is this with a clean build directory? The toolchain file is ignored
once CMake has run and has done compiler detection.

On Wed, Jul 17, 2019 at 11:29 AM hex  wrote:

I specified my toolchain like so:

1cmake -DCMAKE_TOOLCHAIN_FILE=myToolchain.cmake ..

and created a toolchain file in project/myToolchain.cmake.

Using relative path CMake first looks relative to the top of the build 
directory, then if not found there, relative to the top of the source directory.

What means “the top of the source directory”? I placed the file in the source 
directory and receive:

1234CMake Warning:
   Manually-specified variables were not used by the project:

 CMAKE_TOOLCHAIN_FILE

--

Powered bywww.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 
athttp://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://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:
https://cmake.org/mailman/listinfo/cmake


[CMake] relative path to toolchain does not work

2019-07-17 Thread hex

I specified my toolchain like so:

1|cmake -DCMAKE_TOOLCHAIN_FILE=myToolchain.cmake .. |//

and created a toolchain file in|project/myToolchain.cmake|.

Using relative path CMake first looks relative to the top of the build 
directory, then if not found there, relative to the top of the source 
directory.


What means “the top of the source directory”? I placed the file in the 
source directory and receive:


1234|CMake Warning: Manually-specified variables were not used by the 
project: CMAKE_TOOLCHAIN_FILE|


-- 

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] question about version details in source code

2019-07-17 Thread hex

hello community,

I am receiving a|fatal error: foobar_version.h: No such file or 
directory|for|foobar_version.h|. The reason is that the source file is 
generated in|${CMAKE_CURRENT_BINARY_DIR}/foobar_version.cpp|while the 
header file is in|${CMAKE_CURRENT_SOURCE_DIR}|as seen here:


1234|configure_file(foobar_version.cpp.in foobar_version.cpp @ONLY) # 
configure_file(foobar_version.h foobar_version.h @ONLY) 
add_library(foobar_version STATIC 
${CMAKE_CURRENT_BINARY_DIR}/foobar_version.cpp) |//


In the source I simply|#include "foobar_version.h"|but the file is in a 
different location.


Why is this|CMakeLists.txt|file placing the files in different 
locations? What should I do about it?




also, what is the purpose of|mylib.cpp|, I had to create it otherwise I 
receive:|No SOURCES given to target: fooToolkit|. The build is 
successful but my file is currently empty. Here are all build steps:


123456789|configure_file(foobar_version.cpp.in foobar_version.cpp @ONLY) 
configure_file(foobar_version.h foobar_version.h @ONLY) 
add_library(foobar_version STATIC 
${CMAKE_CURRENT_BINARY_DIR}/foobar_version.cpp) add_executable(foobar 
main.cpp) target_link_libraries(foobar PRIVATE foobar_version) 
add_library(fooToolkit mylib.cpp) target_link_libraries(fooToolkit 
PRIVATE foobar_version) |//




thank you

-- 

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] CMake guidelines and design patterns - recommendations?

2019-07-11 Thread hex

hello community,


Does anyone have a book recommendation for modern CMake with focus on 
design patterns?



thank you

--

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] how to set current source directory relative to external project

2019-07-09 Thread Hex
When I use CMAKE_BINARY_DIR the problem remains. If I 

set( EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin ) in my external project
the binary is placed in build/ext1-prefix/src/ext1-build/bin/.

Wouldn't it be better to have all my binaries in a single location? Such as
build/bin/ ? The only way I see to do this is to modify the paths in my
external projects to the parent directories, as has already been suggested.
Or copying them into that location after the build.

I don't think variables are propagated from the CMake project to the
external project. 



--
Sent from: http://cmake.3232098.n2.nabble.com/
-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] how to set current source directory relative to external project

2019-07-09 Thread hex


>   Except for my generators


well, to be exact it's not /except for/ . I am using multiple generators 
which means multiple copies of build targets.



-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] how to set current source directory relative to external project

2019-07-09 Thread hex
I don't know what sorts of files those are; they don't exist but they 
get created, they're not tracked, and not installed...


They sounds like a build product, which is a target, (even it it's just 
part of a product, it's still a target)


Exactly, these are mostly BYPRODUCTS, but also OUTPUT of build commands, 
i.e. targets.





Another thing I noticed is that my CMAKE_GENERATOR are now buried
in subfolders. To change that I set PREFIX
"${CMAKE_BINARY_DIR}/workspaces". Now all external projects are
using the same prefix and are therefore generated into the same
directory 'workspaces'.

right ?


Except for my generators, and I think I wasn't clear enough about this 
part. I am using -G"Eclipse 2 - Unix Makefiles" for each external 
project. Note that this leaves me with a Makefile for the "super build" 
containing *all* targets of all projects. It *additionally* creates a 
Makefile for each external project individually. So I can do stuff like:


/*cd build/ && make* # /to build the entire project or

*/cd build/workspaces/src/ext1-build/ && make/* # to build a specific 
external project, /ext1./



This is what I am after -> a multi-workspace super build. By workspace 
here I mean an eclipse workspace, the terminology does not exist in 
CMake. Note that each project has its own root binary path, meaning that


${CMAKE_BINARY_DIR} = build # for super build

and

${CMAKE_BINARY_DIR} = build/workspaces/src/ext1-build # for external 
project ext1



${CMAKE_CURRENT_BINARY_DIR} is then relative to any of either 
${CMAKE_BINARY_DIR}'s.




-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] how to set current source directory relative to external project

2019-07-09 Thread hex

On 09/07/2019 18:25, J Decker wrote:


On Tue, Jul 9, 2019 at 9:38 AM hex <mailto:hex...@gmail.com>> wrote:



I think the better solution now is to make it relative to build
directory and force out of source builds.


+1 I think; You said it was generated?  It should be in the build 
directory anyway :)

And out of source always.  (makes it easier to source version control)


Now that I look at it it seems very obvious. I still have doubts, though:

I guess I am seeing the contents of a build directory as somewhat 
volatile. For most files I want that, to either clean the project or 
override the files.


But what about files I want to archive, such as a tarball or zipped 
documentation: does it make sense to place them into the build 
directory? The files belong to the project, though are not source 
controlled but aren't install targets either.


Another thing I noticed is that my CMAKE_GENERATOR are now buried in 
subfolders. To change that I set PREFIX 
"${CMAKE_BINARY_DIR}/workspaces". Now all external projects are using 
the same prefix and are therefore generated into the same directory 
'workspaces'.


I could even set PREFIX "${CMAKE_SOURCE_DIR}/workspaces" which I'd 
actually prefer.


The default binary directory is per project so I'd also change this to 
BINARY_DIR=${CMAKE_BINARY_DIR}


I'm not concerned about /how/ to do it but rather /if/ it should be 
done. The documentation recommends to stick with the defaults.



Any thoughts on this?

-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] how to set current source directory relative to external project

2019-07-09 Thread hex

thank you J Decker for your reply.


Your suggestion does work but I want to preserve standalone use of the 
project, meaning that I want a reference to CMake source root directory.


Assuming there is only 1 hierarchy I could add an option:


if ( SUPERBUILD )

/message("${CMAKE_SOURCE_DIR}/.. = /home/user/super/ext1/..")/

/else ()/

message("${CMAKE_SOURCE_DIR} = /home/user/super/ext1")//

endif ()


I think the better solution now is to make it relative to build 
directory and force out of source builds.



On 09/07/2019 14:26, J Decker wrote:


/message("${CMAKE_SOURCE_DIR}/.. = /home/user/super/ext1/..")/  which 
== /home/user/super




-- 

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] how to set current source directory relative to external project

2019-07-09 Thread hex

hello CMake community,


I am experimenting with external projects. I have some files in an 
external project which are generated in `${CMAKE_SOURCE_DIR}`.



When I add the external project, however, it is using 
`${CMAKE_SOURCE_DIR}` of the external project.



I need `${CMAKE_SOURCE_DIR}` to be relative to the "super build", 
instead of the external project path.



Example:

/message("${CMAKE_SOURCE_DIR} = /home/user/super")//
//
//ExternalProject_Add(ext1//
//    # directory options//
//    SOURCE_DIR  "${CMAKE_SOURCE_DIR}/ext1"//
//)/


${CMAKE_SOURCE_DIR}/ext1/CMakeLists.txt:


/message("${CMAKE_SOURCE_DIR} = /home/user/super/ext1")/


The desired outcome would be to have the path /home/user/super in both 
messages.

How can I do this?


thank you
-- 

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] how to set current source directory relative to external project

2019-07-09 Thread hex

hello CMake community,


I am experimenting with external projects. I have documentation in an 
external project which is generated in `${CMAKE_CURRENT_SOURCE_DIR}`.



When I add the external project, however, it is using 
`${CMAKE_CURRENT_SOURCE_DIR}` of the "super build".



I need `${CMAKE_CURRENT_SOURCE_DIR}` to be equal to `${SOURCE_DIR}`, 
where the former is seen by the external project and the latter by the 
"super build".



Example:

message("${CMAKE_CURRENT_SOURCE_DIR} = /home/user/super")

ExternalProject_Add(ext1
    # directory options
    SOURCE_DIR  "${CMAKE_CURRENT_SOURCE_DIR}/ext1"
)


${CMAKE_CURRENT_SOURCE_DIR}/ext1/CMakeLists.txt:


message("${CMAKE_CURRENT_SOURCE_DIR} = /home/user/super/ext1")



--

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] externalproject fails on submodule

2019-07-08 Thread hex
there was a merge conflict on the submodule. Fixing the issue resolved 
the problem.




--

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] externalproject fails on submodule

2019-07-08 Thread hex

hello CMake community,


I am using a private git repository with SSH URL with two different git 
remote server. The repository on github is using an git submodule on 
bitbucket.



/include( ExternalProject )//
//
//ExternalProject_Add(test//
//    GIT_REPOSITORY g...@github.com:myuser/myprivaterepo.git//
//    GIT_REMOTE_NAME origin//
//)/


1. Cloning the repository 'origin/master' is successful

2. Cloning into the submodule fails: it is unable to check out a git commit

3. To test my SSH connection I tried above CMake commands cloning solely 
the submodule, which is successful (see below with different URL)



/include( ExternalProject )//

//ExternalProject_Add(test//
//    GIT_REPOSITORY g...@bitbucket.org:myusername/mysubmodule.git//
//    GIT_REMOTE_NAME origin//
//)/


The complete error message from first example is given below:



Scanning dependencies of target test
[ 12%] Creating directories for 'test'
[ 25%] Performing download step (git clone) for 'test'
Cloning into 'test'...
Already on 'master'
Your branch is up-to-date with 'origin/master'.
Submodule 'mysubmodule' (g...@bitbucket.org:myusername/mysubmodule.git) 
registered for path 'mysubmodule'

Cloning into 'mysubmodule'...
fatal: reference is not a tree: 6a0b950ed42ce225cc2df0
Unable to checkout '6a0b950ed42ce225cc2df0' in submodule path 'mysubmodule'
CMake Error at 
/home/user/testing/build/test-prefix/tmp/test-gitclone.cmake:49 (message):

  Failed to update submodules in:
  '/home/user/testing/build/test-prefix/src/test'


How can I use the repository with submodules?


thank you

-- 

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] install multiple versions of CMake on your system

2019-06-23 Thread hex

hello,

I'd like to install CMake under /usr/local/cmake/3.15/bin/ or similar.

Is it possible to add the version number to a build option, like 
-DCMAKE_INSTALL_PREFIX


or do I need to modify CMake sources?


thank you

--

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] hiding targets from cmake build?

2019-05-29 Thread hex
In cmake mark_as_advanced will not display variables in any of the cmake 
GUIs unless the show advanced option is on.


I wonder if there is an equivalent for build targets?

I have a bunch of custom_targets custom_a, custom_b, custom_c, ... which 
all depend on custom_all


I don't want all targets to be listed in

cmake --build . --target help


It appears there is a solution for Visual Studio [1] by hiding folders. 
I am using SublimeText, though.


Is there a native solution? Otherwise approximately which steps should I 
take to make a script / plug-in.



[1]: https://stackoverflow.com/a/45918184/10530671

--

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] transitive linkage of OBJECT library targets

2019-05-22 Thread hex

Without cycling dependencies you can do something like this:

/add_executable(test_object_lib_nesting main.cpp)//
//
//target_link_libraries(test_object_lib_nesting//
//    second_object_lib//
//    first_object_lib//
//)/


The problem I have that the linker command line will have only the
second.cpp.o for linking the first.cpp.o will not be added as link
object to the exe. Causing missing symbols on exe linkage.

How to transitively resolve and link "nested" Object library targets ?.
-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] cmake doesn't run all tests

2019-05-21 Thread hex

hello Eric,

Some of my recent changes prevented my function to add a build target. 
It was building either one or the other but not both. Therefore, half of 
the tests where missing.


You are right it is working correctly now.

thank you for your patience.

This should work at least it "works-for-me" so there must be some 
difference between the CMakeLists.txt in the directory that works and 
in the directory that does not.

Do you have a sample setup which exhibit the issue that you can share?

-- 

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] cmake doesn't run all tests

2019-05-21 Thread hex

hello,

I have two modules in my CMake project:

/root//
//├── foo//
//│   ├── CMakeLists.txt//
//│   ├── src//
//│   │   └── foo.c//
//│   └── tests//
//│   ├── foo_unit_test.c//
//│   └── CMakeLists.txt//
//├── CMakeLists.txt//
//└── moo//
//    ├── CMakeLists.txt//
//    ├── src//
//    │   └── moo.c//
//    └── tests//
//    ├── CMakeLists.txt//
//    └── moo_unit_test.c//
/
my root project has:

/enable_testing()//
//
//add_subdirectory(adder)//
//add_subdirectory(viterbi_encoder)/


and each module has:

/add_subdirectory(tests)/


For the tests I am using add_test() and make all test.

yet, this only runs the tests within the first add_subdirectory. Other 
modules are ignored.


How can I run all tests at once?

Thank you in advance.

-- 

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] optional parameters in add_custom_target?

2019-05-20 Thread hex

The function is defined as

*add_custom_target(Name [ALL] [command1 [args1...]]**
**   [COMMAND command2 [args2...] ...]**
**   [DEPENDS depend depend depend ... ]**
**   [BYPRODUCTS [files...]]**
**   [WORKING_DIRECTORY dir]**
**   [COMMENT comment]**
**   [VERBATIM] [USES_TERMINAL]**
**   [COMMAND_EXPAND_LISTS]**
**   [SOURCES src1 [src2...]]**
**)*

While its arguments are all documented, I am confused about its optional 
parameters:


*add_custom_target(Name [ALL] [command1 [args1...]]*

- ALL: target depends on ALL

- command1 [args1...]]: ???


What means command1 [args1...]]? Or, should this read

*add_custom_target(Name [ALL] [COMMAND command1 [args1...]]**
**   [COMMAND command2 [args2...] ...]*

-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] Language Dependency for TCL?

2019-05-18 Thread hex
I didn't know about Tclsh. I see now it is part of TCL. This is useful, 
thank you.


Probably because the following isn't properly set if you don't enable 
a language:

CMAKE_FIND_LIBRARY_SUFFIXES
CMAKE_FIND_LIBRARY_PREFIXES

You could probably just use "find_package(Tclsh)" to just find the shell.
https://cmake.org/cmake/help/v3.14/module/FindTclsh.html
-- 

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] Language Dependency for TCL?

2019-05-16 Thread hex

hello,

I am setting up a TCL project so I disabled all language variables:

*cmake_minimum_required(VERSION 2.4)**
**
**project(P LANGUAGES NONE)**
**find_package(TCL)*


however, this fails with

*-- Could NOT find TCL (missing: TCL_LIBRARY) **
**-- Could NOT find TCLTK (missing: TCL_LIBRARY TK_LIBRARY) **
**-- Could NOT find TK (missing: TK_LIBRARY) *


If I instead add languages to the project the TCL package works. This 
makes me wonder what dependencies TCL has with standard languages. Is 
the package incomplete? Why do I need to use a language that I do not 
intend to use?


for example:

*cmake_minimum_required(VERSION 2.4)**
**
**project(P LANGUAGES C)**
**find_package(TCL)**
*

*-- Found Tclsh: /usr/bin/tclsh (found version "8.6") **
**-- Found TCL: /usr/lib/x86_64-linux-gnu/libtcl.so **
**-- Found TCLTK: /usr/lib/x86_64-linux-gnu/libtcl.so **
**-- Found TK: /usr/lib/x86_64-linux-gnu/libtk.so *


thank you

-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] c++2a

2019-05-09 Thread hex

ummh, sooo... h, do you like... cheese?

On 5/9/19 7:21 AM, Stefan Fendt wrote:

Am 07.05.2019 um 20:37 schrieb Angel Campoverde:

Next time please ask what computer I am using.

*What*? Really? *Please* give this a second thought...

Stefan


--

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] CMake with two C++ compilers

2019-05-08 Thread Hex
set the compiler for each build:

set(COMPILER /opt/gcc/bin)
cmake_force_c_compiler(  "${COMPILER}gcc" GNU)
cmake_force_cxx_compiler("${COMPILER}g++" GNU)



--
Sent from: http://cmake.3232098.n2.nabble.com/
-- 

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] how to fetch a git submodule for a build target?

2019-05-07 Thread hex

hello,


I am using the following command to add a git submodule to an existing 
repository:



add_custom_command(OUTPUT fetch

  COMMAND git submodule add https://github.com/user/repo.git

)

add_custom_target(new DEPENDS fetch)


This is working as intended. Adding an already existing submodule to 
the repo does not present any problem by git, as for my build system 
though it results in an error and the build target fails.



how can I make the build fail gracefully?


thank you in advance


--

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] further configuration of generated projects outside of CMake?

2019-03-13 Thread hex

I see now the generators are part of CMake sources on gitlab...

that answers my questions.

thank you, Zan Lynx.




On March 11, 2019 6:03:24 PM MDT, hex  wrote:



Another question, I didn't know there is a generator for sublime text 2:

https://cmake.org/cmake/help/latest/generator/Sublime%20Text%202.html

Is the source code for generators available? I think it would be fun 
adding some improvements.


best regards! 

--

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] further configuration of generated projects outside of CMake?

2019-03-12 Thread hex



Oh, I see now. The generator only adds the project files and the rest of 
the build output remains exactly the same with or without a generator. 
So I only use the generator once. Folders and libraries are not added in 
Eclipse GUI but rather in CMake project as you'd normally do. The 
project is already configured for the standard build targets normally used.


If I had a new build target at some point, like `make doxygen` I'd 
probably edit the project manually and add it.


On 12/03/19 03:00, Zan Lynx wrote:

On March 11, 2019 6:03:24 PM MDT, hex  wrote:

hi everyone,

There are many generators supported in CMake. A CMake build system
allows me to generate the preferred build environment for everyone,
visual studio, eclipse, ninja you name it.

The problem I see with this is that projects are generated output
files,
and even if that gives everyone the starting point in the way he/she is

used to, they will probably want to further customize their project
preferences. But every build folder, every library that is added to the

project sources later on in CMake must be reflected in those projects
as
well. This means any customizations done outside of CMake is lost.

You don't ship the generated files with the source. Everyone runs 
cmake for themselves.


And if you did ship some, like a Makefile, you would not customize 
that any more than you'd customize it from an autoconf project.

--

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] further configuration of generated projects outside of CMake?

2019-03-11 Thread hex

hi everyone,

There are many generators supported in CMake. A CMake build system 
allows me to generate the preferred build environment for everyone, 
visual studio, eclipse, ninja you name it.


The problem I see with this is that projects are generated output files, 
and even if that gives everyone the starting point in the way he/she is 
used to, they will probably want to further customize their project 
preferences. But every build folder, every library that is added to the 
project sources later on in CMake must be reflected in those projects as 
well. This means any customizations done outside of CMake is lost.


I cannot see how to overcome this limitation. What is the workflow for 
generated projects here?



Another question, I didn't know there is a generator for sublime text 2:

https://cmake.org/cmake/help/latest/generator/Sublime%20Text%202.html

Is the source code for generators available? I think it would be fun 
adding some improvements.


best regards!

--

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] Dependee "DependInfo.cmake" is newer than depender "depend.internal".

2019-02-06 Thread hex

hello community,

During compilation, cmake shows the information message

*Dependee "DependInfo.cmake" is newer than depender "depend.internal".*

to explain why a file needs to be recompiled.

imediately after

*    -- Build files have been written to: ./build**
**    /usr/bin/cmake -H. -B./build --check-build-system 
CMakeFiles/Makefile.cmake 0**
**    /usr/bin/cmake -E cmake_progress_start ./build/CMakeFiles 
./build/CMakeFiles/progress.marks**

*

Can this be optimized?

Which files do I have to look at? There is a file 
"build/CMakeFiles/Makefile.cmake" which sets dependency order:


*# The generator used is:**
**set(CMAKE_DEPENDS_GENERATOR "Unix Makefiles")**
**
**# The top level Makefile was generated from the following files:**
**set(CMAKE_MAKEFILE_DEPENDS**
**  "CMakeCache.txt"**
**  "utils.cmake"**
**  "../CMakeLists.txt"**
**  "../Toolchains/tc.cmake"**
**  "CMakeFiles/3.5.1/CMakeCCompiler.cmake"**
**  "CMakeFiles/3.5.1/CMakeCXXCompiler.cmake"**
**  "CMakeFiles/3.5.1/CMakeSystem.cmake"**
**  "/usr/share/cmake-3.5/Modules/CMakeCCompiler.cmake.in"**
**  "/usr/share/cmake-3.5/Modules/CMakeCInformation.cmake"**
**  "/usr/share/cmake-3.5/Modules/CMakeCXXCompiler.cmake.in"**
**  "/usr/share/cmake-3.5/Modules/CMakeCXXInformation.cmake"**
**"/usr/share/cmake-3.5/Modules/CMakeCommonLanguageInclude.cmake"**
**"/usr/share/cmake-3.5/Modules/CMakeDetermineCCompiler.cmake"**
**"/usr/share/cmake-3.5/Modules/CMakeDetermineCXXCompiler.cmake"**
**  "/usr/share/cmake-3.5/Modules/CMakeDetermineCompiler.cmake"**
**  "/usr/share/cmake-3.5/Modules/CMakeDetermineSystem.cmake"**
**  "/usr/share/cmake-3.5/Modules/CMakeFindBinUtils.cmake"**
**  "/usr/share/cmake-3.5/Modules/CMakeForceCompiler.cmake"**
**  "/usr/share/cmake-3.5/Modules/CMakeGenericSystem.cmake"**
**"/usr/share/cmake-3.5/Modules/CMakeLanguageInformation.cmake"**
**  "/usr/share/cmake-3.5/Modules/CMakeSystem.cmake.in"**
**"/usr/share/cmake-3.5/Modules/CMakeSystemSpecificInformation.cmake"**
**"/usr/share/cmake-3.5/Modules/CMakeSystemSpecificInitialize.cmake"**
**  "/usr/share/cmake-3.5/Modules/CMakeTestCCompiler.cmake"**
**  "/usr/share/cmake-3.5/Modules/CMakeTestCXXCompiler.cmake"**
**  "/usr/share/cmake-3.5/Modules/CMakeUnixFindMake.cmake"**
**  "/usr/share/cmake-3.5/Modules/Compiler/GNU-C.cmake"**
**  "/usr/share/cmake-3.5/Modules/Compiler/GNU-CXX.cmake"**
**  "/usr/share/cmake-3.5/Modules/Compiler/GNU.cmake"**
**  "/usr/share/cmake-3.5/Modules/MultiArchCross.cmake"**
**  "/usr/share/cmake-3.5/Modules/Platform/Generic.cmake"**
**  )**
**
**# The corresponding makefile is:**
**set(CMAKE_MAKEFILE_OUTPUTS**
**  "Makefile"**
**  "CMakeFiles/cmake.check_cache"**
**  )**
**
**# Byproducts of CMake generate step:**
**set(CMAKE_MAKEFILE_PRODUCTS**
**  "CMakeFiles/3.5.1/CMakeSystem.cmake"**
**  "CMakeFiles/3.5.1/CMakeCCompiler.cmake"**
**  "CMakeFiles/3.5.1/CMakeCXXCompiler.cmake"**
**  "CMakeFiles/CMakeDirectoryInformation.cmake"**
**  )**
**
**# Dependency information for all targets:**
**set(CMAKE_DEPEND_INFO_FILES**
**  "CMakeFiles/hello-world.dir/DependInfo.cmake"**
**  )**
*


Also, after this build step:

*    make -f CMakeFiles/Makefile2 all**
**    make[1]: Entering directory './build'**
**    make -f CMakeFiles/hello-world.dir/build.make 
CMakeFiles/hello-world.dir/depend**

**    make[2]: Entering directory './build'**
*
it sais:

*    -E cmake_depends "Unix Makefiles" ./ ./ ./build ./build 
./build/CMakeFiles/hello-world.dir/DependInfo.cmake --color=**

*
why are the folders "./" and "./build" appearing twice?

this is my build command:

*    cmake -DCMAKE_TOOLCHAIN_FILE=Toolchains/tc.cmake 
-DCMAKE_BUILD_TYPE=Debug*



thank you
-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] undefined reference to `_exit'

2019-02-04 Thread hex

dear community,

This question has originally been placed in another community [1].
I did read the mailing list netiquette before posting here but I was not 
aware this behaviour is discouraged.
Therefore, I want to apologize. Good etiquette is important, I am 
grateful for any advice on how I can make the Internet a better place.


The solution to the undefined reference errors is to set the

-specs=nosys.specs flag as mentioned here [2]
in combination with not using the -nostartfiles flag which made the 
_exit referenced in nosys.specs not being used.


Since this is also making this question a duplicate of [2] I decided to 
delete it in stackoverflow.


Thank you for your help.


[1] 
https://stackoverflow.com/questions/54487747/cmake-undefined-reference-to-exit-while-including-startup-code-as-a-library
[2] 
https://stackoverflow.com/questions/19419782/exit-c-text0x18-undefined-reference-to-exit-when-using-arm-none-eabi-gcc



--

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] undefined reference to `_exit'

2019-02-01 Thread hex

hello,

I am trying to include a static library that contains the startup code 
for ARM processor to my  CMake project for cross compilation.


I included the linker script and added it to the executable. Flags and 
include files are properly set in the CMake build output. The path to 
the library is also correctly seen.


The linker fails on the startup code:


|Scanning dependencies of target testApp [ 50%] Building CXX object 
CMakeFiles/testApp.dir/src/main.c.obj [100%] Linking CXX executable 
testApp 
/opt/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/thumb/v7-ar/fpv3/hard/libc.a(lib_a-exit.o): 
In function `exit': exit.c:(.text.exit+0x1c): undefined reference to 
`_exit' 
/opt/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/thumb/v7-ar/fpv3/hard/libc.a(lib_a-fini.o): 
In function `__libc_fini_array': fini.c:(.text.__libc_fini_array+0x2c): 
undefined reference to `_fini' 
/opt/gcc-arm-none-eabi-7-2017-q4-major/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/thumb/v7-ar/fpv3/hard/libc.a(lib_a-init.o): 
In function `__libc_init_array': init.c:(.text.__libc_init_array+0x38): 
undefined reference to `_init' collect2: error: ld returned 1 exit 
status Here is my CMakeLists file: *cmake_minimum_required(VERSION 
3.5.1)project (hello-world)**set(SOURCE_FILES 
src/main.c)**set (LINKER_SCRIPT 
linker_script.ld)**add_executable(${TARGET_NAME} 
${SOURCE_FILES})**set_target_properties( ${TARGET_NAME} PROPERTIES 
LINK_DEPENDS ${LINKER_SCRIPT})**set(CMAKE_EXE_LINKER_FLAGS 
"${CMAKE_EXE_LINKER_FLAGS} -Wl,-build-id=none -Wl,-T ${LINKER_SCRIPT} " 
CACHE STRING "" FORCE )**set(COMMON_FLAGS "${COMMON_FLAGS} 
-march=armv7-a")set(COMMON_FLAGS "${COMMON_FLAGS} 
-mfpu=vfpv3")set(COMMON_FLAGS "${COMMON_FLAGS} 
-mfloat-abi=hard")set(COMMON_FLAGS "${COMMON_FLAGS} 
-Wall")set(COMMON_FLAGS "${COMMON_FLAGS} -O0")set(COMMON_FLAGS 
"${COMMON_FLAGS} -nostartfiles")set(COMMON_FLAGS "${COMMON_FLAGS} 
-fmessage-length=0")set(COMMON_FLAGS "${COMMON_FLAGS} 
-fno-exceptions")set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} 
${COMMON_FLAGS}")set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} 
${COMMON_FLAGS}")**include_directories( inc 
)**find_library(LIB_C NAMES libc PATHS "lib" 
)**target_link_libraries(${TARGET_NAME} ${LIB_C})*** How can I solve 
this problem? The only dependency here is the library itself... Thank 
you in advance for any response. |


-- 

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] can I use cmake in parallel with Eclipse IDE?

2019-01-26 Thread hex

hello,

I want to use CMake as my primary build system. At some point I would 
like to take advantage of the tools provided by IDEs, such as stepping 
through code.


I know I can use CMake to generate an eclipse project, or use Eclipse to 
generate a CMake project. My doubt is whether these options are merely 
meant for import purposes or can these be used in parallel, i.e., 
switching between my CMake project and Eclipse back and forth.


I was reading about /*launch.json*/ files and it seems that these can be 
used to launch any application with it.


please advice,


thank you

-- 

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] explain usage of CMAKE_CONFIGURATION_TYPES

2019-01-22 Thread hex

good afternoon,

I am following the CMake book to learn about CMake. I have trouble to 
follow chapter 3: build configurations 
(https://riptutorial.com/cmake/example/26702/setting-a-release-debug-configuration)


In this part it is not very clear why these configurations are used, 
and how they work.


here is the script in cmake:

*CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11)**
**SET(PROJ_NAME "myproject")**
**PROJECT(${PROJ_NAME})**
**
*# Configuration types*
**SET(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" 
FORCE)**

**IF(DEFINED CMAKE_BUILD_TYPE AND CMAKE_VERSION VERSION_GREATER "2.8")**
**  SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 
${CMAKE_CONFIGURATION_TYPES})**

**ENDIF()**
**
**SET(${PROJ_NAME}_PATH_INSTALL "/opt/project" 
CACHE PATH "This directory contains installation Path")**

**SET(CMAKE_DEBUG_POSTFIX "d")**
*
# Install
#---#*
**INSTALL(TARGETS ${PROJ_NAME}**
**    DESTINATION 
"${${PROJ_NAME}_PATH_INSTALL}/lib/${CMAKE_BUILD_TYPE}/"**

**    )**
*

So, instead of building the project relative to my project folder, it 
installs into "/opt/" directory in linux. Why would I want/prefere to 
do that? And what if I am working with Windows, instead?


Since the application is build in "/opt/" it suggests that cmake in 
above example functions similar to an software installer.



The documentation on cmake.org states that CMAKE_CONFIGURATION_TYPES 
specifies multiple build types (Debug, Release, Test, etc), which is 
ultimately what I am interested in.


I suppose I am also able to use this concept if I want relative path 
for debug/release directories like in Eclipse?



thank you!

-- 

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:
https://cmake.org/mailman/listinfo/cmake