Re: [CMake] Visual Studio 2017

2017-09-15 Thread Matějů Miroslav , Ing .
Hello Randy,

From: CMake [mailto:cmake-boun...@cmake.org] On Behalf Of Randy Heiland
Sent: Friday, September 15, 2017 1:38 PM

> Is there a "best way" to use cmake for VS17 (but same cakelists for Linux)? 
> And by "best", I mean with minimal effort on users.
> To be more specific, on Windows, I *think* I'd like to have users install the 
> cmake binary, then use Powershell to build an application.
Is there really a need for using PowerShell if you also want to use the same 
CMakeLists for Linux?

> But my initial attempt to do so is confusing. I install VS17 (for C++), it 
> installs in standard path, but 'cl' is not found in Powershell. I read that I 
> shouldn't edit my PATH (nor do I really want users to have to), but run some 
> .bat instead to setup my env. So, how should one specify the compiler for 
> cmake? Oh yes, then I see that VS17 also has its own cmake??
Have you run CMake successfully yet? I am not really aware how it works but 
CMake *can* for sure detect VS in my CLI environment without having VS in PATH. 
If you use an IDE that understands CMake (like VS17 or Qt Creator, for 
example), you should be able to open a CMake project in the IDE and build it 
there. Please report your particular problem if it does not work for you.
If you prefer to run cl.exe in CLI, then vcvarsall.bat is the .bat file you are 
looking for.

Best regards,

Ing. Miroslav Matějů
Programmer Analyst

AŽD Praha s.r.o.
Technology Division
Research and Development
Žirovnická 2/3146, 106 17  Prague
Czech Republic
Phone: +420 267 287 476
Web: www.azd.cz
-- 

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] CTest model deviates from the requsted one

2017-09-12 Thread Matějů Miroslav , Ing .
Hi,

I would like to report the following problem. I experienced that CTest running 
a CTestScript with a manually specified model (e.g. CTEST_START(Experimental)) 
sometimes deviates from the selected model. For example, when the test model 
Nightly is requested, the test sometimes gets reported to CDash as Continuous; 
the Experimental model might get reported as Nightly or Continuous. I started 
to experience this problem massively when I started to run Continuous tests in 
addition to Nightly tests on my server.

I tried to add debug messages to the CTest and shell scripts which control the 
testing process in my environment. I found out that the wrong decision happens 
during the CTEST_START call.

The code:

IF (NOT BUILD_MODEL)
MESSAGE (FATAL_ERROR "Build model is not set")
ENDIF (NOT BUILD_MODEL)
CTEST_EMPTY_BINARY_DIRECTORY ("${CTEST_BINARY_DIRECTORY}")
MESSAGE(STATUS "Build model: ${BUILD_MODEL}")
CTEST_START (${BUILD_MODEL})
MESSAGE(STATUS "Build model: ${BUILD_MODEL}")

renders (using ctest -VV):

-- Build model: Experimental
SetCTestConfiguration:SourceDirectory:/home/ctest/trunk/tests/moduletests/cm
SetCTestConfiguration:BuildDirectory:/home/ctest/trunk/_build/moduletests/cm
Run dashboard with model Experimental
   Source directory: /home/ctest/trunk/tests/moduletests/cm
   Build directory: moduletests/cm
   Reading ctest configuration file: 
/home/ctest/trunk/tests/moduletests/cm/CTestConfig.cmake
SetCTestConfigurationFromCMakeVariable:NightlyStartTime:CTEST_NIGHTLY_START_TIME
SetCTestConfiguration:NightlyStartTime:01:00:00 UTC
SetCTestConfigurationFromCMakeVariable:Site:CTEST_SITE
SetCTestConfiguration:Site:MiM-testsrv-ubuntu
SetCTestConfigurationFromCMakeVariable:BuildName:CTEST_BUILD_NAME
SetCTestConfiguration:BuildName:cm
   Site: MiM-testsrv-ubuntu
   Build name: cm
   Use Continuous tag: 20170912-0800
-- Build model: Experimental

I tried to upgrade CMake from the distribution-provided version up to 3.9.1 but 
the problem persists.

I noticed that the problem appears after changing the model in the same build 
directory, despite it has been wiped using CTEST_EMPTY_BINARY_DIRECTORY. CTest 
seems to prefer the previously used model sometimes instead of the explicitly 
given one (using CTEST_START). So I am currently trying to work around it by 
using separate build directories for each model. Is it the correct way or would 
you recommend something else?

Best regards,

Ing. Miroslav Matějů
Programmer Analyst

AŽD Praha s.r.o.
Technology Division
Research and Development
Žirovnická 2/3146, 106 17  Prague
Czech Republic
Phone: +420 267 287 476
Web: www.azd.cz
-- 

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] How to use CMake with Eclipse CDT?

2016-04-20 Thread Matějů Miroslav , Ing .
Hi David,

Generation of project files in CMake is a one-way process. CMake is not able to 
edit its own input (CMakeLists.txt). To update a project managed by CMake, you 
should update CMakeLists.txt manually and regenerate your CDT project.

Best regards,

Miroslav

From: CMake [mailto:cmake-boun...@cmake.org] On Behalf Of David Aldrich
Sent: Wednesday, April 20, 2016 11:42 AM
To: cmake@cmake.org
Subject: [CMake] How to use CMake with Eclipse CDT?

Hi

I want to build an Eclipse CDT (C++) project on Linux that can be maintained 
using CMake.  I have seen the notes on the Eclipse CDT4 Generator here:

https://cmake.org/Wiki/Eclipse_CDT4_Generator

Is the sole purpose of that generator to create a CDT project from a CMake 
makefile?

Or, having run the generator, will CDT continue to maintain the project with 
CMake, adding new source files to CMakeLists.txt as required?  This is what I 
want to achieve, so that my project can be built by another IDE, that 
understands CMake but not CDT, at any time.

Best regards

David

-- 

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] CMakeLists.txt: How to print a message if ctest fails?

2016-04-19 Thread Matějů Miroslav , Ing .
Hi Muhammad,

You need to add this code to a separate CTest script (CTestScript.cmake, for 
example) and then run it using ctest -S CTestScript.cmake. Since the wiki page 
I linked yesterday provides only some complex examples, I am sending the key 
part of my CTest script. As you can see, its operation strongly depends on 
environment variables (some of them are provided by Windows). You’ll probably 
need to remove most of my if’s.

set(CTEST_SOURCE_DIRECTORY "$ENV{SCRIPT_FOLDER}")
set(CTEST_BINARY_DIRECTORY "$ENV{BINARY_PROJECT_FOLDER}")

set(CTEST_SITE  $ENV{COMPUTERNAME})
set(CTEST_BUILD_NAME$ENV{TEST_CASE_NAME})

ctest_start()

ctest_configure(RETURN_VALUE configure_failed)

if($ENV{DO_UPDATE})
  ctest_update()
endif($ENV{DO_UPDATE})

if($ENV{DO_BUILD})
  ctest_build(RETURN_VALUE build_failed)
endif($ENV{DO_BUILD})

if   (($ENV{DO_TEST}) AND NOT (configure_failed OR build_failed))
  ctest_test(RETURN_VALUE test_failed)
endif(($ENV{DO_TEST}) AND NOT (configure_failed OR build_failed))

if($ENV{DO_DASHBOARD})
  ctest_submit()
endif($ENV{DO_DASHBOARD})

if   (configure_failed OR build_failed OR test_failed)
  message(FATAL_ERROR "Test ${CTEST_BUILD_NAME} failed.")  # sets return value 
to -1
endif(configure_failed OR build_failed OR test_failed)

Best regards,
Miroslav

From: Muhammad Osama [mailto:osam...@gmail.com]
Sent: Monday, April 18, 2016 8:33 PM
To: Matějů Miroslav, Ing.
Cc: cmake@cmake.org
Subject: Re: [CMake] CMakeLists.txt: How to print a message if ctest fails?

Hi Miroslav,

Thank you for replying! I added this in my root CMakeLists.txt, purposely made 
the ctest's test fail but didn't get the output message.
Is this script suppose to be added inside CMakeLists.txt? Or am I doing this 
incorrectly?

Thanks again,

On Mon, Apr 18, 2016 at 6:30 AM, Matějů Miroslav, Ing. 
<mateju.miros...@azd.cz<mailto:mateju.miros...@azd.cz>> wrote:
Hi Muhammad,
you can use a CTest script, see https://cmake.org/Wiki/CMake_Scripting_Of_CTest 
for details. I use the following code in my CTest script:

if(configure_failed OR build_failed OR test_failed)
message(FATAL_ERROR "Test ${CTEST_BUILD_NAME} failed.")
endif()

Best regards,
Miroslav

From: CMake [mailto:cmake-boun...@cmake.org<mailto:cmake-boun...@cmake.org>] On 
Behalf Of Muhammad Osama
Sent: Friday, April 15, 2016 8:53 PM
To: cmake@cmake.org<mailto:cmake@cmake.org>
Subject: [CMake] CMakeLists.txt: How to print a message if ctest fails?

Is there a way I can setup CMakeLists.txt to print a message if ctest tests 
fail? For example:

cmake ..
make
ctest // fails
message output: Please contact x...@mail.com<mailto:x...@mail.com> to resolve 
testing problems.
​Note the message output is not for cmake but for ctest.​

--​​
Muhammad


--
Muhammad
-- 

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] CMakeLists.txt: How to print a message if ctest fails?

2016-04-18 Thread Matějů Miroslav , Ing .
Hi Muhammad,
you can use a CTest script, see https://cmake.org/Wiki/CMake_Scripting_Of_CTest 
for details. I use the following code in my CTest script:

if(configure_failed OR build_failed OR test_failed)
message(FATAL_ERROR "Test ${CTEST_BUILD_NAME} failed.")
endif()

Best regards,
Miroslav

From: CMake [mailto:cmake-boun...@cmake.org] On Behalf Of Muhammad Osama
Sent: Friday, April 15, 2016 8:53 PM
To: cmake@cmake.org
Subject: [CMake] CMakeLists.txt: How to print a message if ctest fails?

Is there a way I can setup CMakeLists.txt to print a message if ctest tests 
fail? For example:

cmake ..
make
ctest // fails
message output: Please contact x...@mail.com to resolve 
testing problems.
​Note the message output is not for cmake but for ctest.​

--​​
Muhammad
-- 

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] issue with target_link_libraries and MSVC

2016-04-13 Thread Matějů Miroslav , Ing .
The page I linked says /openmp is a compiler flag (not linker flag), so adding 
it to CMAKE_CXX_FLAGS instead of LINK_FLAGS makes perfect sense.

Miroslav

From: Benjamin Ballet [mailto:bbal...@ivsweb.com]
Sent: Wednesday, April 13, 2016 11:28 AM
To: Matějů Miroslav, Ing.
Cc: cmake@cmake.org
Subject: Re: [CMake] issue with target_link_libraries and MSVC

Ho yes, my bad, however there is still the same issue with forward slashes

I receive the flag with FindOpenMP module. It's sad we can't do :
target_link_libraries(... ${OpenMP_CXX_FLAGS}) for a few target

In the end I add the flags for the whole project :
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")

2016-04-13 7:54 GMT+02:00 Matějů Miroslav, Ing. 
<mateju.miros...@azd.cz<mailto:mateju.miros...@azd.cz>>:
Hi Benjamin,

MSVC flags start with “forward” slashes: / (However, MSVC also accepts hyphens 
(-) in my experience.)
Documentation for /openmp flag: https://msdn.microsoft.com/library/fw509c3b.aspx

Best regards,
Miroslav

From: CMake [mailto:cmake-boun...@cmake.org<mailto:cmake-boun...@cmake.org>] On 
Behalf Of Benjamin Ballet via CMake
Sent: Tuesday, April 12, 2016 5:30 PM
To: cmake@cmake.org<mailto:cmake@cmake.org>
Subject: [CMake] issue with target_link_libraries and MSVC

I'm trying to add the openmp flag to a target with target_link_libraries.
\openmp is interpreted as a file name and visual try to link to \openmp.obj

The documentation state that target_link_libraries see an item as a flag if it 
start with - but MSVC flags start with \

Is there a way to add a link flags to a target with target_link_libraries and 
MSVC ?

Thank you all

--
Benjamin BALLET
Ingénieur R

ACTIVISU
19, rue Klock - 92110 Clichy
> Standard Tél :  01 44 69 37 37
> www.activisu.com<http://www.activisu.com/>


--
Benjamin BALLET
Ingénieur R

ACTIVISU
19, rue Klock - 92110 Clichy
> Standard Tél :  01 44 69 37 37
> www.activisu.com<http://www.activisu.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:
http://public.kitware.com/mailman/listinfo/cmake

Re: [CMake] issue with target_link_libraries and MSVC

2016-04-12 Thread Matějů Miroslav , Ing .
Hi Benjamin,

MSVC flags start with “forward” slashes: / (However, MSVC also accepts hyphens 
(-) in my experience.)
Documentation for /openmp flag: https://msdn.microsoft.com/library/fw509c3b.aspx

Best regards,
Miroslav

From: CMake [mailto:cmake-boun...@cmake.org] On Behalf Of Benjamin Ballet via 
CMake
Sent: Tuesday, April 12, 2016 5:30 PM
To: cmake@cmake.org
Subject: [CMake] issue with target_link_libraries and MSVC

I'm trying to add the openmp flag to a target with target_link_libraries.
\openmp is interpreted as a file name and visual try to link to \openmp.obj

The documentation state that target_link_libraries see an item as a flag if it 
start with - but MSVC flags start with \

Is there a way to add a link flags to a target with target_link_libraries and 
MSVC ?

Thank you all

--
Benjamin BALLET
Ingénieur R

ACTIVISU
19, rue Klock - 92110 Clichy
> Standard Tél :  01 44 69 37 37
> www.activisu.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:
http://public.kitware.com/mailman/listinfo/cmake

Re: [CMake] Parsing command line arguments from the make

2016-04-05 Thread Matějů Miroslav , Ing .
Hi Fedja,

As far as I know, the Makefiles generated  from CMake cannot contain decisions. 
CMake supports several output types aside from Makefiles and some of them 
probably don’t support decisions. However, you could supply these arguments 
within CMake call using -D option. For example
cmake -DENV=VERSION_2 
creates a CMake variable just like
set(ENV "VERSION_2" CACHE)
in the CMake source file.

As you’ve mentioned already, you can access environment variables using 
$ENV{variable} syntax in CMake.

Hope this helps.

Miroslav

From: CMake [mailto:cmake-boun...@cmake.org] On Behalf Of Fedja Jeleskovic
Sent: Friday, April 01, 2016 8:08 PM
To: cmake@cmake.org
Subject: [CMake] Parsing command line arguments from the make

Since I am converting existing makefile project to use cmake instead I need to 
accept values that come from command line which looks like this:
VARIABLE_NAME="/home/user/project" make ENV=VERSION_2

First one is used like this:
include $(VARIABLE_NAME)/Makefile.include

Second one has this code that triggers different paths later:
ifneq ($(ENV),)
DEPLOYMENT_VERSION=$(ENV)
endif

How do I do this in cmake?

Thanks!
-- 

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] CTest: Handle output of a custom CTEST_CONFIGURE_COMMAND

2016-03-16 Thread Matějů Miroslav , Ing .
Hi,

I am using CTest to encapsulate automatic build and testing of a 
microcontroller software and report results to CDash. This process generally 
works but I am facing a problem with handling configure errors within CTest and 
CDash.

Configure phase involves several tools besides CMake, so I have created a 
batch-file and use it as a custom CTEST_CONFIGURE_COMMAND:

set(CTEST_CONFIGURE_COMMAND "$ENV{SCRIPT_FOLDER}/configure.bat")

When one of configure tools fails, configure.bat exits with a positive return 
value using 'exit /b %ERRCODE_TOOL%'.

If I run configure.bat directly, I can check the desired value is returned by 
running 'echo %ERRORLEVEL%' after the script finishes.

However, when the script is called from CTest script using 
'ctest_configure(RETURN_VALUE configure_failed)', the variable configure_failed 
does not prevent building, although following code is used:

if   ($ENV{DO_BUILD} AND NOT configure_failed)
  ctest_build(RETURN_VALUE build_failed)
endif($ENV{DO_BUILD} AND NOT configure_failed)

Also the report of configure phase in CDash contains:

Configure Command: D:/checkout/integration/script//configure.bat
Configure Return Value: 0
Configure Output:

[configure] -- XMLConf --
error: Cannot find CFG overlay XML file
[configure] Error: XMLConf failed.

CDash reports 0 errors and 0 warnings for the configure phase, although the 
last two lines of configure.bat output go to stderr.

What can I do to get configure errors properly reported in my environment?

I use Windows 7 64-bit and native CMake 3.5.0.

Thanks in advance for any help!

Miroslav Matějů
-- 

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