View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015059CMakeCMakepublic2014-08-05 04:242015-01-05 08:39
Reporterk0n3ru 
Assigned ToBrad King 
PrioritynormalSeveritytextReproducibilityalways
StatusclosedResolutionfixed 
PlatformLinuxOSSLES OS Version11
Product VersionCMake 2.8.10.2 
Target VersionCMake 3.1Fixed in VersionCMake 3.1 
Summary0015059: Clarify documentation of CMake custom build step PRE_LINK/PRE_BUILD
DescriptionPRE_LINK and PRE_BUILD do not seem to work in CMake on linux ( generating MakeFiles ).

The documentation says that only PRE_BUILD is not supported. But , PRE_LINK does not work at all.And PRE_BUILD is built *after* the actual target.

From the documentation :

"Note that the PRE_BUILD option is only supported on Visual Studio 7 or later. For all other generators PRE_BUILD will be treated as PRE_LINK."




Steps To Reproducecmake_minimum_required(VERSION 2.8.5)
project(custom_command_test)

add_custom_target(my_actual_target
    COMMAND echo " I am the actual taget "
    COMMENT "Running actual target"
    )
add_custom_command(
    TARGET my_actual_target
    PRE_LINK
    COMMAND echo "I am prelinked to actual target"
    COMMENT " Running PRELINK action "
    )
add_custom_command(
    TARGET my_actual_target
    PRE_BUILD
    COMMAND echo " I am prebuilt to actual target"
    COMMENT " Running PRE_BUILD action"
    )
add_custom_command(
    TARGET my_actual_target
    POST_BUILD
    COMMAND echo " I postbuild to actual target"
    COMMENT " Running POST BUILD action "
    )


=================================================
On running the above :

> cmake .
-- The C compiler identification is GNU 4.4.2
-- The CXX compiler identification is GNU 4.4.2
-- Check for working C compiler: XXXX/gcc/4.4.2/bin/gcc
-- Check for working C compiler: XXXX/gcc/4.4.2/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: XXXX/gcc/4.4.2/bin/g++
-- Check for working CXX compiler: XXXX/gcc/4.4.2/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: XXXX

 > make my_actual_target
Scanning dependencies of target my_actual_target
[100%] Running actual target
 I am the actual taget
 Running PRE_BUILD action
 I am prebuilt to actual target
 Running POST BUILD action
 I postbuild to actual target
[100%] Built target my_actual_target

> cmake --version
cmake version 2.8.10.2
Additional InformationWorkaround is to add a fake target and POST_BUILD step on it. Then creating dependency seems to work. But, it has its own issues.For my setup , it creates problems when parallel make ( -j ) is done.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0036553)
Brad King (manager)
2014-08-05 10:18

PRE_LINK is not defined for targets created by add_custom_target because they do not link. After revising the documentation structure:

 Help: Remove stray content from 'add_custom_command' docs
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cb88742d [^]

 Help: Revise and format 'add_custom_command' docs
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2a58c872 [^]

I've added an explicit statement of this restriction:

 Help: Document add_custom_command PRE_BUILD/PRE_LINK for exe/lib only
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5bf1c5cc [^]
(0037611)
Robert Maynard (manager)
2015-01-05 08:39

Closing resolved issues that have not been updated in more than 4 months

 Issue History
Date Modified Username Field Change
2014-08-05 04:24 k0n3ru New Issue
2014-08-05 10:18 Brad King Note Added: 0036553
2014-08-05 10:20 Brad King Assigned To => Brad King
2014-08-05 10:20 Brad King Status new => assigned
2014-08-05 10:20 Brad King Target Version => CMake 3.1
2014-08-05 10:20 Brad King Summary CMake custom build step PRE_LINK/PRE_BUILD do not work => Clarify documentation of CMake custom build step PRE_LINK/PRE_BUILD
2014-08-11 09:48 Brad King Severity feature => text
2014-08-11 09:48 Brad King Status assigned => resolved
2014-08-11 09:48 Brad King Resolution open => fixed
2014-08-11 09:48 Brad King Fixed in Version => CMake 3.1
2015-01-05 08:39 Robert Maynard Note Added: 0037611
2015-01-05 08:39 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team