Tests: Don't read the LOCATION property from build targets.

This commit is contained in:
Stephen Kelly 2013-11-18 17:49:20 +01:00
parent cffcdd8331
commit a247911a88
7 changed files with 13 additions and 28 deletions

View File

@ -25,13 +25,11 @@ set_target_properties(shared shared2 framework PROPERTIES
# testbundleutils1 will load this at runtime # testbundleutils1 will load this at runtime
add_library(module1 MODULE module.cpp module.h) add_library(module1 MODULE module.cpp module.h)
set_target_properties(module1 PROPERTIES PREFIX "") set_target_properties(module1 PROPERTIES PREFIX "")
get_target_property(module_loc module1 LOCATION)
target_link_libraries(module1 shared2) target_link_libraries(module1 shared2)
# a bundle application # a bundle application
add_executable(testbundleutils1 MACOSX_BUNDLE testbundleutils1.cpp) add_executable(testbundleutils1 MACOSX_BUNDLE testbundleutils1.cpp)
target_link_libraries(testbundleutils1 shared framework ${CMAKE_DL_LIBS}) target_link_libraries(testbundleutils1 shared framework ${CMAKE_DL_LIBS})
get_target_property(loc testbundleutils1 LOCATION)
set_target_properties(testbundleutils1 module1 PROPERTIES set_target_properties(testbundleutils1 module1 PROPERTIES
INSTALL_RPATH "${CMAKE_CURRENT_BINARY_DIR}/testdir1" INSTALL_RPATH "${CMAKE_CURRENT_BINARY_DIR}/testdir1"
@ -40,8 +38,8 @@ set_target_properties(testbundleutils1 module1 PROPERTIES
# add custom target to install and test the app # add custom target to install and test the app
add_custom_target(testbundleutils1_test ALL add_custom_target(testbundleutils1_test ALL
COMMAND ${CMAKE_COMMAND} COMMAND ${CMAKE_COMMAND}
"-DINPUT=${loc}" "-DINPUT=$<TARGET_FILE:testbundleutils1>"
"-DMODULE=${module_loc}" "-DMODULE=$<TARGET_FILE:module1>"
"-DINPUTDIR=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}" "-DINPUTDIR=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}"
"-DOUTPUTDIR=${CMAKE_CURRENT_BINARY_DIR}/testdir1" "-DOUTPUTDIR=${CMAKE_CURRENT_BINARY_DIR}/testdir1"
-P "${CMAKE_CURRENT_SOURCE_DIR}/bundleutils.cmake" -P "${CMAKE_CURRENT_SOURCE_DIR}/bundleutils.cmake"
@ -58,13 +56,11 @@ add_dependencies(testbundleutils1_test testbundleutils1)
# testbundleutils2 will load this at runtime # testbundleutils2 will load this at runtime
add_library(module2 MODULE module.cpp module.h) add_library(module2 MODULE module.cpp module.h)
set_target_properties(module2 PROPERTIES PREFIX "") set_target_properties(module2 PROPERTIES PREFIX "")
get_target_property(module_loc module2 LOCATION)
target_link_libraries(module2 shared2) target_link_libraries(module2 shared2)
# a non-bundle application # a non-bundle application
add_executable(testbundleutils2 testbundleutils2.cpp) add_executable(testbundleutils2 testbundleutils2.cpp)
target_link_libraries(testbundleutils2 shared framework ${CMAKE_DL_LIBS}) target_link_libraries(testbundleutils2 shared framework ${CMAKE_DL_LIBS})
get_target_property(loc testbundleutils2 LOCATION)
set_target_properties(testbundleutils2 module2 PROPERTIES set_target_properties(testbundleutils2 module2 PROPERTIES
INSTALL_RPATH "${CMAKE_CURRENT_BINARY_DIR}/testdir2" INSTALL_RPATH "${CMAKE_CURRENT_BINARY_DIR}/testdir2"
@ -73,8 +69,8 @@ set_target_properties(testbundleutils2 module2 PROPERTIES
# add custom target to install and test the app # add custom target to install and test the app
add_custom_target(testbundleutils2_test ALL add_custom_target(testbundleutils2_test ALL
COMMAND ${CMAKE_COMMAND} COMMAND ${CMAKE_COMMAND}
"-DINPUT=${loc}" "-DINPUT=$<TARGET_FILE:testbundleutils2>"
"-DMODULE=${module_loc}" "-DMODULE=$<TARGET_FILE:module2>"
"-DINPUTDIR=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}" "-DINPUTDIR=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}"
"-DOUTPUTDIR=${CMAKE_CURRENT_BINARY_DIR}/testdir2" "-DOUTPUTDIR=${CMAKE_CURRENT_BINARY_DIR}/testdir2"
-P "${CMAKE_CURRENT_SOURCE_DIR}/bundleutils.cmake" -P "${CMAKE_CURRENT_SOURCE_DIR}/bundleutils.cmake"
@ -106,13 +102,11 @@ if(APPLE AND NOT CMAKE_SYSTEM_VERSION VERSION_LESS 9.0)
# testbundleutils1 will load this at runtime # testbundleutils1 will load this at runtime
add_library(module3 MODULE module.cpp module.h) add_library(module3 MODULE module.cpp module.h)
set_target_properties(module3 PROPERTIES PREFIX "" LINK_FLAGS "-Wl,-rpath,@loader_path/") set_target_properties(module3 PROPERTIES PREFIX "" LINK_FLAGS "-Wl,-rpath,@loader_path/")
get_target_property(module_loc module3 LOCATION)
target_link_libraries(module3 shared2-3) target_link_libraries(module3 shared2-3)
# a non-bundle application # a non-bundle application
add_executable(testbundleutils3 testbundleutils3.cpp) add_executable(testbundleutils3 testbundleutils3.cpp)
target_link_libraries(testbundleutils3 shared-3 framework-3 ${CMAKE_DL_LIBS}) target_link_libraries(testbundleutils3 shared-3 framework-3 ${CMAKE_DL_LIBS})
get_target_property(loc testbundleutils3 LOCATION)
set_target_properties(testbundleutils3 module3 PROPERTIES set_target_properties(testbundleutils3 module3 PROPERTIES
LINK_FLAGS "-Wl,-rpath,@loader_path/") LINK_FLAGS "-Wl,-rpath,@loader_path/")
@ -120,8 +114,8 @@ if(APPLE AND NOT CMAKE_SYSTEM_VERSION VERSION_LESS 9.0)
# add custom target to install and test the app # add custom target to install and test the app
add_custom_target(testbundleutils3_test ALL add_custom_target(testbundleutils3_test ALL
COMMAND ${CMAKE_COMMAND} COMMAND ${CMAKE_COMMAND}
"-DINPUT=${loc}" "-DINPUT=$<TARGET_FILE:testbundleutils3>"
"-DMODULE=${module_loc}" "-DMODULE=$<TARGET_FILE:module3>"
"-DINPUTDIR=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}" "-DINPUTDIR=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}"
"-DOUTPUTDIR=${CMAKE_CURRENT_BINARY_DIR}/testdir3" "-DOUTPUTDIR=${CMAKE_CURRENT_BINARY_DIR}/testdir3"
-P "${CMAKE_CURRENT_SOURCE_DIR}/bundleutils.cmake" -P "${CMAKE_CURRENT_SOURCE_DIR}/bundleutils.cmake"

View File

@ -29,9 +29,6 @@ set (EXECUTABLE_OUTPUT_PATH
# add the executable that will generate the file # add the executable that will generate the file
add_executable(generator generator.cxx) add_executable(generator generator.cxx)
get_target_property(generator_PATH generator LOCATION)
message("Location ${generator_PATH}")
################################################################ ################################################################
# #
# Test using a wrapper to wrap a header file # Test using a wrapper to wrap a header file
@ -189,7 +186,7 @@ add_executable(CustomCommand
# generated source in a target. # generated source in a target.
add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/generated.c add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/generated.c
DEPENDS generator DEPENDS generator
COMMAND ${generator_PATH} COMMAND generator
ARGS ${PROJECT_BINARY_DIR}/generated.c ARGS ${PROJECT_BINARY_DIR}/generated.c
) )

View File

@ -11,13 +11,13 @@ endif()
add_library(mylibA STATIC mylibA.c) add_library(mylibA STATIC mylibA.c)
set_property(TARGET mylibA PROPERTY set_property(TARGET mylibA PROPERTY
ARCHIVE_OUTPUT_DIRECTORY "${LinkDirectory_BINARY_DIR}/External/lib") ARCHIVE_OUTPUT_DIRECTORY "${LinkDirectory_BINARY_DIR}/External/lib")
get_property(mylibA TARGET mylibA PROPERTY LOCATION) # get_property(mylibA TARGET mylibA PROPERTY LOCATION)
# Build a library into our build tree relative to the subproject build tree. # Build a library into our build tree relative to the subproject build tree.
add_library(mylibB STATIC mylibB.c) add_library(mylibB STATIC mylibB.c)
set_property(TARGET mylibB PROPERTY set_property(TARGET mylibB PROPERTY
ARCHIVE_OUTPUT_DIRECTORY "${LinkDirectory_BINARY_DIR}/lib") ARCHIVE_OUTPUT_DIRECTORY "${LinkDirectory_BINARY_DIR}/lib")
get_property(mylibB TARGET mylibB PROPERTY LOCATION) # get_property(mylibB TARGET mylibB PROPERTY LOCATION)
# Create a custom target to drive the subproject build. # Create a custom target to drive the subproject build.
include(ExternalProject) include(ExternalProject)
@ -38,7 +38,7 @@ ExternalProject_Add_Step(ExternalTarget cleanup
COMMAND ${CMAKE_COMMAND} -E remove_directory ${LinkDirectory_BINARY_DIR}/bin COMMAND ${CMAKE_COMMAND} -E remove_directory ${LinkDirectory_BINARY_DIR}/bin
DEPENDEES download DEPENDEES download
DEPENDERS configure DEPENDERS configure
DEPENDS ${mylibA} ${mylibB} DEPENDS mylibA mylibB
"${LinkDirectory_BINARY_DIR}/External/CMakeLists.txt" "${LinkDirectory_BINARY_DIR}/External/CMakeLists.txt"
"${LinkDirectory_BINARY_DIR}/External/myexe.c" "${LinkDirectory_BINARY_DIR}/External/myexe.c"
) )

View File

@ -5,7 +5,6 @@ project(ToClean)
add_executable(toclean toclean.cxx) add_executable(toclean toclean.cxx)
# List some build-time-generated files. # List some build-time-generated files.
get_target_property(TOCLEAN_FILES toclean LOCATION)
set(TOCLEAN_FILES ${TOCLEAN_FILES} set(TOCLEAN_FILES ${TOCLEAN_FILES}
"${ToClean_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/toclean.dir/toclean.cxx${CMAKE_CXX_OUTPUT_EXTENSION}") "${ToClean_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/toclean.dir/toclean.cxx${CMAKE_CXX_OUTPUT_EXTENSION}")

View File

@ -1,13 +1,11 @@
# first we add the executable that generates the table # first we add the executable that generates the table
add_executable(MakeTable MakeTable.cxx) add_executable(MakeTable MakeTable.cxx)
get_target_property(MakeTableLocation MakeTable LOCATION)
# add the command to generate the source code # add the command to generate the source code
add_custom_command ( add_custom_command (
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Table.h OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Table.h
DEPENDS MakeTable DEPENDS MakeTable
COMMAND ${MakeTableLocation} COMMAND MakeTable
ARGS ${CMAKE_CURRENT_BINARY_DIR}/Table.h ARGS ${CMAKE_CURRENT_BINARY_DIR}/Table.h
) )

View File

@ -1,13 +1,11 @@
# first we add the executable that generates the table # first we add the executable that generates the table
add_executable(MakeTable MakeTable.cxx) add_executable(MakeTable MakeTable.cxx)
get_target_property(MakeTableLocation MakeTable LOCATION)
# add the command to generate the source code # add the command to generate the source code
add_custom_command ( add_custom_command (
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Table.h OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Table.h
DEPENDS MakeTable DEPENDS MakeTable
COMMAND ${MakeTableLocation} COMMAND MakeTable
ARGS ${CMAKE_CURRENT_BINARY_DIR}/Table.h ARGS ${CMAKE_CURRENT_BINARY_DIR}/Table.h
) )

View File

@ -89,9 +89,8 @@ set (FLTK_SRCS
fltk1.fl fltk1.fl
) )
add_executable(fakefluid fakefluid.cxx) add_executable(fakefluid fakefluid.cxx)
get_target_property(FLUID_LOC fakefluid LOCATION)
set (FLTK_WRAP_UI "On") set (FLTK_WRAP_UI "On")
set (FLTK_FLUID_EXECUTABLE "${FLUID_LOC}") set (FLTK_FLUID_EXECUTABLE fakefluid)
fltk_wrap_ui (wraplibFLTK ${FLTK_SRCS}) fltk_wrap_ui (wraplibFLTK ${FLTK_SRCS})
add_library(wraplibFLTK ${wraplibFLTK_FLTK_UI_SRCS}) add_library(wraplibFLTK ${wraplibFLTK_FLTK_UI_SRCS})
add_dependencies(wraplibFLTK fakefluid) add_dependencies(wraplibFLTK fakefluid)