View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015018CMakeCMakepublic2014-07-12 16:412016-06-10 14:31
ReporterAndrew Aladjev 
Assigned ToKitware Robot 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionmoved 
Platformx86_64OSGentooOS Version2.2
Product VersionCMake 3.0 
Target VersionFixed in Version 
Summary0015018: Try_run with project and target
Description"try_compile" has ability to work with complete project and it's target, "try_run" do not. Why?
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0036358)
Brad King (manager)
2014-07-14 08:49

It was simply never implemented. We almost never use try_run in practice anymore because it does not work for cross-compiling.

Besides, the whole-project signature of try_compile leaves the build tree around instead of using a temporary directory and then deleting it. That means the binary will be available to try running with execute_process.
(0037191)
Andrew Aladjev (reporter)
2014-11-12 06:00

Ok. This works good

  cmake_minimum_required (VERSION "2.8")
  project ("check" "C")
  
  set (CMAKE_TRY_RUN false CACHE BOOL "try run targets after build")
  
  add_executable (
    "main"
    "${CMAKE_CURRENT_SOURCE_DIR}/main.c"
  )
  
  if (${CMAKE_TRY_RUN})
    add_custom_command(
      TARGET "main"
      POST_BUILD
      COMMAND "./main"
      WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
      COMMENT "Running main"
    )
  endif ()
(0042585)
Kitware Robot (administrator)
2016-06-10 14:29

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2014-07-12 16:41 Andrew Aladjev New Issue
2014-07-14 08:49 Brad King Note Added: 0036358
2014-11-12 06:00 Andrew Aladjev Note Added: 0037191
2016-06-10 14:29 Kitware Robot Note Added: 0042585
2016-06-10 14:29 Kitware Robot Status new => resolved
2016-06-10 14:29 Kitware Robot Resolution open => moved
2016-06-10 14:29 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team